Added copyright and license
[libcds.git] / tests / test-hdr / list / hdr_intrusive_lazy_rcu_shb.cpp
1 /*
2     This file is a part of libcds - Concurrent Data Structures library
3
4     (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
5
6     Source code repo: http://github.com/khizmax/libcds/
7     Download: http://sourceforge.net/projects/libcds/files/
8     
9     Redistribution and use in source and binary forms, with or without
10     modification, are permitted provided that the following conditions are met:
11
12     * Redistributions of source code must retain the above copyright notice, this
13       list of conditions and the following disclaimer.
14
15     * Redistributions in binary form must reproduce the above copyright notice,
16       this list of conditions and the following disclaimer in the documentation
17       and/or other materials provided with the distribution.
18
19     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23     FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     
29 */
30
31 #include "list/hdr_intrusive_lazy.h"
32 #include <cds/urcu/signal_buffered.h>
33 #include <cds/intrusive/lazy_list_rcu.h>
34
35 namespace ordlist {
36 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
37     namespace {
38         typedef cds::urcu::gc< cds::urcu::signal_buffered<> >    RCU;
39     }
40 #endif
41
42     void IntrusiveLazyListHeaderTest::RCU_SHB_base_cmp()
43     {
44 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
45         typedef base_int_item< RCU > item;
46         typedef ci::lazy_list::make_traits<
47             ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
48             ,co::compare< cmp<item> >
49             ,ci::opt::disposer< faked_disposer >
50         >::type list_traits;
51         typedef ci::LazyList< RCU, item, list_traits > list;
52
53         test_rcu_int<list>();
54 #endif
55     }
56
57     void IntrusiveLazyListHeaderTest::RCU_SHB_base_less()
58     {
59 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
60         typedef base_int_item< RCU > item;
61         typedef ci::LazyList< RCU
62             ,item
63             ,ci::lazy_list::make_traits<
64                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
65                 ,co::less< less<item> >
66                 ,ci::opt::disposer< faked_disposer >
67             >::type
68         >    list;
69         test_rcu_int<list>();
70 #endif
71     }
72
73     void IntrusiveLazyListHeaderTest::RCU_SHB_base_cmpmix()
74     {
75 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
76         typedef base_int_item< RCU > item;
77         typedef ci::LazyList< RCU
78             ,item
79             ,ci::lazy_list::make_traits<
80                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
81                 ,co::less< less<item> >
82                 ,co::compare< cmp<item> >
83                 ,ci::opt::disposer< faked_disposer >
84             >::type
85         >    list;
86         test_rcu_int<list>();
87 #endif
88     }
89
90     void IntrusiveLazyListHeaderTest::RCU_SHB_base_ic()
91     {
92 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
93         typedef base_int_item< RCU > item;
94         typedef ci::LazyList< RCU
95             ,item
96             ,ci::lazy_list::make_traits<
97                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
98                 ,co::less< less<item> >
99                 ,co::compare< cmp<item> >
100                 ,ci::opt::disposer< faked_disposer >
101                 ,co::item_counter< cds::atomicity::item_counter >
102             >::type
103         >    list;
104         test_rcu_int<list>();
105 #endif
106     }
107
108     void IntrusiveLazyListHeaderTest::RCU_SHB_member_cmp()
109     {
110 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
111         typedef member_int_item< RCU > item;
112         typedef ci::LazyList< RCU
113             ,item
114             ,ci::lazy_list::make_traits<
115                 ci::opt::hook< ci::lazy_list::member_hook<
116                     offsetof( item, hMember ),
117                     co::gc<RCU>
118                 > >
119                 ,co::compare< cmp<item> >
120                 ,ci::opt::disposer< faked_disposer >
121             >::type
122         >    list;
123         test_rcu_int<list>();
124 #endif
125     }
126
127     void IntrusiveLazyListHeaderTest::RCU_SHB_member_less()
128     {
129 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
130         typedef member_int_item< RCU > item;
131         typedef ci::LazyList< RCU
132             ,item
133             ,ci::lazy_list::make_traits<
134                 ci::opt::hook< ci::lazy_list::member_hook<
135                     offsetof( item, hMember ),
136                     co::gc<RCU>
137                 > >
138                 ,co::less< less<item> >
139                 ,ci::opt::disposer< faked_disposer >
140             >::type
141         >    list;
142         test_rcu_int<list>();
143 #endif
144     }
145
146     void IntrusiveLazyListHeaderTest::RCU_SHB_member_cmpmix()
147     {
148 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
149         typedef member_int_item< RCU > item;
150         typedef ci::LazyList< RCU
151             ,item
152             ,ci::lazy_list::make_traits<
153                 ci::opt::hook< ci::lazy_list::member_hook<
154                     offsetof( item, hMember ),
155                     co::gc<RCU>
156                 > >
157                 ,co::less< less<item> >
158                 ,co::compare< cmp<item> >
159                 ,ci::opt::disposer< faked_disposer >
160             >::type
161         >    list;
162         test_rcu_int<list>();
163 #endif
164     }
165
166     void IntrusiveLazyListHeaderTest::RCU_SHB_member_ic()
167     {
168 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
169         typedef member_int_item< RCU > item;
170         typedef ci::LazyList< RCU
171             ,item
172             ,ci::lazy_list::make_traits<
173                 ci::opt::hook< ci::lazy_list::member_hook<
174                     offsetof( item, hMember ),
175                     co::gc<RCU>
176                 > >
177                 ,co::compare< cmp<item> >
178                 ,ci::opt::disposer< faked_disposer >
179                 ,co::item_counter< cds::atomicity::item_counter >
180             >::type
181         >    list;
182         test_rcu_int<list>();
183 #endif
184     }
185
186 }   // namespace ordlist