6738b4b0e4882c611fe71c921faa70f6f3543a20
[libcds.git] / tests / test-hdr / list / hdr_intrusive_lazy_rcu_sht.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_threaded.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_threaded<> >    RCU;
39     }
40 #endif
41
42     void IntrusiveLazyListHeaderTest::RCU_SHT_base_cmp()
43     {
44 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
45         typedef base_int_item< RCU > item;
46         typedef ci::LazyList< RCU
47             ,item
48             ,ci::lazy_list::make_traits<
49                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
50                 ,co::compare< cmp<item> >
51                 ,ci::opt::disposer< faked_disposer >
52             >::type
53         >    list;
54         test_rcu_int<list>();
55 #endif
56     }
57     void IntrusiveLazyListHeaderTest::RCU_SHT_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     void IntrusiveLazyListHeaderTest::RCU_SHT_base_cmpmix()
73     {
74 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
75         typedef base_int_item< RCU > item;
76         typedef ci::LazyList< RCU
77             ,item
78             ,ci::lazy_list::make_traits<
79                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
80                 ,co::less< less<item> >
81                 ,co::compare< cmp<item> >
82                 ,ci::opt::disposer< faked_disposer >
83             >::type
84         >    list;
85         test_rcu_int<list>();
86 #endif
87     }
88     void IntrusiveLazyListHeaderTest::RCU_SHT_base_ic()
89     {
90 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
91         typedef base_int_item< RCU > item;
92         typedef ci::LazyList< RCU
93             ,item
94             ,ci::lazy_list::make_traits<
95                 ci::opt::hook< ci::lazy_list::base_hook< co::gc<RCU> > >
96                 ,co::less< less<item> >
97                 ,co::compare< cmp<item> >
98                 ,ci::opt::disposer< faked_disposer >
99                 ,co::item_counter< cds::atomicity::item_counter >
100             >::type
101         >    list;
102         test_rcu_int<list>();
103 #endif
104     }
105     void IntrusiveLazyListHeaderTest::RCU_SHT_member_cmp()
106     {
107 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
108         typedef member_int_item< RCU > item;
109         typedef ci::LazyList< RCU
110             ,item
111             ,ci::lazy_list::make_traits<
112                 ci::opt::hook< ci::lazy_list::member_hook<
113                     offsetof( item, hMember ),
114                     co::gc<RCU>
115                 > >
116                 ,co::compare< cmp<item> >
117                 ,ci::opt::disposer< faked_disposer >
118             >::type
119         >    list;
120         test_rcu_int<list>();
121 #endif
122     }
123     void IntrusiveLazyListHeaderTest::RCU_SHT_member_less()
124     {
125 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
126         typedef member_int_item< RCU > item;
127         typedef ci::LazyList< RCU
128             ,item
129             ,ci::lazy_list::make_traits<
130                 ci::opt::hook< ci::lazy_list::member_hook<
131                     offsetof( item, hMember ),
132                     co::gc<RCU>
133                 > >
134                 ,co::less< less<item> >
135                 ,ci::opt::disposer< faked_disposer >
136             >::type
137         >    list;
138         test_rcu_int<list>();
139 #endif
140     }
141     void IntrusiveLazyListHeaderTest::RCU_SHT_member_cmpmix()
142     {
143 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
144         typedef member_int_item< RCU > item;
145         typedef ci::LazyList< RCU
146             ,item
147             ,ci::lazy_list::make_traits<
148                 ci::opt::hook< ci::lazy_list::member_hook<
149                     offsetof( item, hMember ),
150                     co::gc<RCU>
151                 > >
152                 ,co::less< less<item> >
153                 ,co::compare< cmp<item> >
154                 ,ci::opt::disposer< faked_disposer >
155             >::type
156         >    list;
157         test_rcu_int<list>();
158 #endif
159     }
160     void IntrusiveLazyListHeaderTest::RCU_SHT_member_ic()
161     {
162 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
163         typedef member_int_item< RCU > item;
164         typedef ci::LazyList< RCU
165             ,item
166             ,ci::lazy_list::make_traits<
167                 ci::opt::hook< ci::lazy_list::member_hook<
168                     offsetof( item, hMember ),
169                     co::gc<RCU>
170                 > >
171                 ,co::compare< cmp<item> >
172                 ,ci::opt::disposer< faked_disposer >
173                 ,co::item_counter< cds::atomicity::item_counter >
174             >::type
175         >    list;
176         test_rcu_int<list>();
177 #endif
178     }
179 }   // namespace ordlist