EndProjectSection\r
EndProject\r
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unit", "unit", "{810490B7-31E5-49AE-8455-CAF99A9658B6}"\r
+ ProjectSection(SolutionItems) = preProject\r
+ ..\..\..\tests\test-hdr\size_check.h = ..\..\..\tests\test-hdr\size_check.h\r
+ EndProjectSection\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-stack", "gtest-stack.vcxproj", "{5407E9D2-67D9-4266-976E-7A90BDE2541D}"\r
ProjectSection(ProjectDependencies) = postProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress-pqueue", "stress-pqueue.vcxproj", "{51AC349E-B365-4FCF-8778-17A1534E4584}"\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest-set", "gtest-set.vcxproj", "{A589D3F1-A749-4268-ADEC-D0CE13D1E359}"\r
+ ProjectSection(ProjectDependencies) = postProject\r
+ {408FE9BC-44F0-4E6A-89FA-D6F952584239} = {408FE9BC-44F0-4E6A-89FA-D6F952584239}\r
+ EndProjectSection\r
EndProject\r
Global\r
GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
<ClCompile Include="..\..\..\test\unit\main.cpp" />\r
<ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_dhp.cpp" />\r
<ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_hp.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_nogc.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpb.cpp">\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpi.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpt.cpp">\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_shb.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_sht.cpp" />\r
<ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_dhp.cpp" />\r
<ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_hp.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_nogc.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpb.cpp">\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpi.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpt.cpp">\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='DebugVLD|x64'">4503</DisableSpecificWarnings>\r
+ <DisableSpecificWarnings Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4503</DisableSpecificWarnings>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_shb.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_sht.cpp" />\r
</ItemGroup>\r
<ItemGroup>\r
+ <ClInclude Include="..\..\..\test\unit\set\test_intrusive_michael_lazy_rcu.h" />\r
+ <ClInclude Include="..\..\..\test\unit\set\test_intrusive_michael_michael_rcu.h" />\r
<ClInclude Include="..\..\..\test\unit\set\test_intrusive_set.h" />\r
<ClInclude Include="..\..\..\test\unit\set\test_intrusive_set_hp.h" />\r
+ <ClInclude Include="..\..\..\test\unit\set\test_intrusive_set_nogc.h" />\r
<ClInclude Include="..\..\..\test\unit\set\test_intrusive_set_rcu.h" />\r
</ItemGroup>\r
<PropertyGroup Label="Globals">\r
<ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_dhp.cpp">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpb.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpi.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_gpt.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_shb.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_rcu_sht.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpb.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpi.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_gpt.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_shb.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_rcu_sht.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_michael_nogc.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\set\intrusive_michael_lazy_nogc.cpp">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\..\..\test\unit\set\test_intrusive_set.h">\r
<ClInclude Include="..\..\..\test\unit\set\test_intrusive_set_rcu.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\..\..\test\unit\set\test_intrusive_michael_michael_rcu.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\test\unit\set\test_intrusive_michael_lazy_rcu.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\test\unit\set\test_intrusive_set_nogc.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
set(PACKAGE_NAME unit-set)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof")
+
set(CDSGTEST_SET_SOURCES
../main.cpp
intrusive_michael_lazy_hp.cpp
intrusive_michael_lazy_dhp.cpp
+ intrusive_michael_lazy_nogc.cpp
+ intrusive_michael_lazy_rcu_gpb.cpp
+ intrusive_michael_lazy_rcu_gpi.cpp
+ intrusive_michael_lazy_rcu_gpt.cpp
+ intrusive_michael_lazy_rcu_shb.cpp
+ intrusive_michael_lazy_rcu_sht.cpp
intrusive_michael_michael_hp.cpp
intrusive_michael_michael_dhp.cpp
+ intrusive_michael_michael_nogc.cpp
+ intrusive_michael_michael_rcu_gpb.cpp
+ intrusive_michael_michael_rcu_gpi.cpp
+ intrusive_michael_michael_rcu_gpt.cpp
+ intrusive_michael_michael_rcu_shb.cpp
+ intrusive_michael_michael_rcu_sht.cpp
)
include_directories(
class IntrusiveMichaelLazySet_DHP : public cds_test::intrusive_set_hp
{
+ protected:
typedef cds_test::intrusive_set_hp base_class;
protected:
class IntrusiveMichaelLazySet_HP : public cds_test::intrusive_set_hp
{
+ protected:
typedef cds_test::intrusive_set_hp base_class;
protected:
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "test_intrusive_set_nogc.h"
+
+#include <cds/intrusive/lazy_list_nogc.h>
+#include <cds/intrusive/michael_set_nogc.h>
+
+#include <mutex>
+
+namespace {
+ namespace ci = cds::intrusive;
+ typedef cds::gc::nogc gc_type;
+
+ class IntrusiveMichaelLazySet_NoGC : public cds_test::intrusive_set_nogc
+ {
+ protected:
+ typedef cds_test::intrusive_set_nogc base_class;
+
+ protected:
+ typedef typename base_class::base_int_item< ci::lazy_list::node<gc_type>> base_item_type;
+ typedef typename base_class::base_int_item< ci::lazy_list::node<gc_type, std::mutex>> base_mutex_item_type;
+ typedef typename base_class::member_int_item< ci::lazy_list::node<gc_type>> member_item_type;
+ typedef typename base_class::member_int_item< ci::lazy_list::node<gc_type, std::mutex>> member_mutex_item_type;
+
+ //void SetUp()
+ //{}
+
+ //void TearDown()
+ //{}
+ };
+
+
+ TEST_F( IntrusiveMichaelLazySet_NoGC, base_cmp )
+ {
+ typedef ci::LazyList< gc_type
+ , base_item_type
+ ,ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type > > >
+ ,ci::opt::compare< cmp<base_item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ ,ci::opt::back_off< cds::backoff::pause >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< gc_type, bucket_type,
+ ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveMichaelLazySet_NoGC, base_less )
+ {
+ typedef ci::LazyList< gc_type
+ , base_item_type
+ ,ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< gc_type >>>
+ ,ci::opt::less< less<base_item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< gc_type, bucket_type,
+ ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveMichaelLazySet_NoGC, base_cmpmix )
+ {
+ struct list_traits : public ci::lazy_list::traits
+ {
+ typedef ci::lazy_list::base_hook< ci::opt::gc<gc_type>> hook;
+ typedef base_class::less<base_item_type> less;
+ typedef cmp<base_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::LazyList< gc_type, base_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveMichaelLazySet_NoGC, base_mutex )
+ {
+ struct list_traits : public ci::lazy_list::traits
+ {
+ typedef ci::lazy_list::base_hook< ci::opt::gc<gc_type>, ci::opt::lock_type<std::mutex>> hook;
+ typedef base_class::less<base_mutex_item_type> less;
+ typedef cmp<base_mutex_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::LazyList< gc_type, base_mutex_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+
+ TEST_F( IntrusiveMichaelLazySet_NoGC, member_cmp )
+ {
+ typedef ci::LazyList< gc_type
+ ,member_item_type
+ ,ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook<
+ offsetof( member_item_type, hMember ),
+ ci::opt::gc<gc_type>
+ > >
+ ,ci::opt::compare< cmp<member_item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< gc_type, bucket_type,
+ ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveMichaelLazySet_NoGC, member_less )
+ {
+ typedef ci::LazyList< gc_type
+ , member_item_type
+ ,ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook<
+ offsetof( member_item_type, hMember ),
+ ci::opt::gc<gc_type>
+ > >
+ ,ci::opt::less< less<member_item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< gc_type, bucket_type,
+ ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveMichaelLazySet_NoGC, member_cmpmix )
+ {
+ struct list_traits : public ci::lazy_list::traits
+ {
+ typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<gc_type>> hook;
+ typedef base_class::less<member_item_type> less;
+ typedef cmp<member_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::LazyList< gc_type, member_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveMichaelLazySet_NoGC, member_mutex )
+ {
+ struct list_traits : public ci::lazy_list::traits
+ {
+ typedef ci::lazy_list::member_hook< offsetof( member_mutex_item_type, hMember ), ci::opt::gc<gc_type>, ci::opt::lock_type<std::mutex>> hook;
+ typedef base_class::less<member_mutex_item_type> less;
+ typedef cmp<member_mutex_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::LazyList< gc_type, member_mutex_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/general_buffered.h>
+
+#include "test_intrusive_michael_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, IntrusiveMichaelLazySet, rcu_implementation );
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/general_instant.h>
+
+#include "test_intrusive_michael_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_instant<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, IntrusiveMichaelLazySet, rcu_implementation );
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/general_threaded.h>
+
+#include "test_intrusive_michael_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, IntrusiveMichaelLazySet, rcu_implementation );
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/signal_buffered.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_michael_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, IntrusiveMichaelLazySet, rcu_implementation );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/signal_threaded.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_michael_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, IntrusiveMichaelLazySet, rcu_implementation );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
class IntrusiveMichaelSet_DHP : public cds_test::intrusive_set_hp
{
+ protected:
typedef cds_test::intrusive_set_hp base_class;
protected:
class IntrusiveMichaelSet_HP : public cds_test::intrusive_set_hp
{
+ protected:
typedef cds_test::intrusive_set_hp base_class;
protected:
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "test_intrusive_set_nogc.h"
+
+#include <cds/intrusive/michael_list_nogc.h>
+#include <cds/intrusive/michael_set_nogc.h>
+
+namespace {
+ namespace ci = cds::intrusive;
+ typedef cds::gc::nogc gc_type;
+
+ class IntrusiveMichaelSet_NoGC : public cds_test::intrusive_set_nogc
+ {
+ protected:
+ typedef cds_test::intrusive_set_nogc base_class;
+
+ protected:
+ typedef typename base_class::base_int_item< ci::michael_list::node<gc_type>> base_item_type;
+ typedef typename base_class::member_int_item< ci::michael_list::node<gc_type>> member_item_type;
+
+ //void SetUp()
+ //{}
+
+ //void TearDown()
+ //{}
+ };
+
+
+ TEST_F( IntrusiveMichaelSet_NoGC, base_cmp )
+ {
+ typedef ci::MichaelList< gc_type
+ , base_item_type
+ ,ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type > > >
+ ,ci::opt::compare< cmp<base_item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< gc_type, bucket_type,
+ ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveMichaelSet_NoGC, base_less )
+ {
+ typedef ci::MichaelList< gc_type
+ , base_item_type
+ ,ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< gc_type >>>
+ ,ci::opt::less< less<base_item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< gc_type, bucket_type,
+ ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveMichaelSet_NoGC, base_cmpmix )
+ {
+ struct list_traits : public ci::michael_list::traits
+ {
+ typedef ci::michael_list::base_hook< ci::opt::gc<gc_type>> hook;
+ typedef base_class::less<base_item_type> less;
+ typedef cmp<base_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::MichaelList< gc_type, base_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+
+ TEST_F( IntrusiveMichaelSet_NoGC, member_cmp )
+ {
+ typedef ci::MichaelList< gc_type
+ ,member_item_type
+ ,ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook<
+ offsetof( member_item_type, hMember ),
+ ci::opt::gc<gc_type>
+ > >
+ ,ci::opt::compare< cmp<member_item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< gc_type, bucket_type,
+ ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveMichaelSet_NoGC, member_less )
+ {
+ typedef ci::MichaelList< gc_type
+ , member_item_type
+ ,ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook<
+ offsetof( member_item_type, hMember ),
+ ci::opt::gc<gc_type>
+ > >
+ ,ci::opt::less< less<member_item_type> >
+ ,ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< gc_type, bucket_type,
+ ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+ TEST_F( IntrusiveMichaelSet_NoGC, member_cmpmix )
+ {
+ struct list_traits : public ci::michael_list::traits
+ {
+ typedef ci::michael_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<gc_type>> hook;
+ typedef base_class::less<member_item_type> less;
+ typedef cmp<member_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::MichaelList< gc_type, member_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< gc_type, bucket_type, set_traits > set_type;
+
+ set_type s( kSize, 2 );
+ test( s );
+ }
+
+} // namespace
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/general_buffered.h>
+
+#include "test_intrusive_michael_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, IntrusiveMichaelSet, rcu_implementation );
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/general_instant.h>
+
+#include "test_intrusive_michael_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_instant<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, IntrusiveMichaelSet, rcu_implementation );
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/general_threaded.h>
+
+#include "test_intrusive_michael_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, IntrusiveMichaelSet, rcu_implementation );
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/signal_buffered.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_michael_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, IntrusiveMichaelSet, rcu_implementation );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <cds/urcu/signal_threaded.h>
+
+#ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
+#include "test_intrusive_michael_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, IntrusiveMichaelSet, rcu_implementation );
+
+#endif // #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
+
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#ifndef CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_LAZY_RCU_H
+#define CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_LAZY_RCU_H
+
+#include "test_intrusive_set_rcu.h"
+#include <cds/intrusive/lazy_list_rcu.h>
+#include <cds/intrusive/michael_set_rcu.h>
+
+namespace ci = cds::intrusive;
+
+template <class RCU>
+class IntrusiveMichaelLazySet: public cds_test::intrusive_set_rcu
+{
+ typedef cds_test::intrusive_set_rcu base_class;
+public:
+ typedef cds::urcu::gc<RCU> rcu_type;
+ typedef typename base_class::base_int_item< ci::lazy_list::node<rcu_type>> base_item_type;
+ typedef typename base_class::base_int_item< ci::lazy_list::node<rcu_type, std::mutex>> base_mutex_item_type;
+ typedef typename base_class::member_int_item< ci::lazy_list::node<rcu_type>> member_item_type;
+ typedef typename base_class::member_int_item< ci::lazy_list::node<rcu_type, std::mutex>> member_mutex_item_type;
+
+protected:
+ void SetUp()
+ {
+ RCU::Construct();
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ RCU::Destruct();
+ }
+};
+
+TYPED_TEST_CASE_P( IntrusiveMichaelLazySet );
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, base_cmp )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::base_item_type base_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::template cmp<base_item_type> cmp;
+ typedef typename TestFixture::hash_int hash_int;
+
+ typedef ci::LazyList< rcu_type
+ , base_item_type
+ , typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< rcu_type > > >
+ , ci::opt::compare< cmp >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< rcu_type, bucket_type,
+ typename ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, base_less )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::base_item_type base_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::template less<base_item_type> less;
+ typedef typename TestFixture::hash_int hash_int;
+
+ typedef ci::LazyList< rcu_type
+ , base_item_type
+ , typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::base_hook< ci::opt::gc< rcu_type >>>
+ , ci::opt::less< less >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< rcu_type, bucket_type,
+ typename ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, base_cmpmix )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::base_item_type base_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::hash_int hash_int;
+
+ struct list_traits : public ci::lazy_list::traits
+ {
+ typedef ci::lazy_list::base_hook< ci::opt::gc<rcu_type>> hook;
+ typedef typename TestFixture::template less<base_item_type> less;
+ typedef typename TestFixture::template cmp<base_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::LazyList< rcu_type, base_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef typename TestFixture::simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, base_mutex )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::base_mutex_item_type base_mutex_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::hash_int hash_int;
+
+ struct list_traits : public ci::lazy_list::traits
+ {
+ typedef ci::lazy_list::base_hook< ci::opt::gc<rcu_type>, ci::opt::lock_type<std::mutex>> hook;
+ typedef typename TestFixture::template less<base_mutex_item_type> less;
+ typedef typename TestFixture::template cmp<base_mutex_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::LazyList< rcu_type, base_mutex_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef typename TestFixture::simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, member_cmp )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::member_item_type member_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::template cmp<member_item_type> cmp;
+ typedef typename TestFixture::hash_int hash_int;
+
+ typedef ci::LazyList< rcu_type
+ , member_item_type
+ , typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook<
+ offsetof( member_item_type, hMember ),
+ ci::opt::gc<rcu_type>
+ >>
+ , ci::opt::compare< cmp >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< rcu_type, bucket_type,
+ typename ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, member_less )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::member_item_type member_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::template less<member_item_type> less;
+ typedef typename TestFixture::hash_int hash_int;
+
+ typedef ci::LazyList< rcu_type
+ , member_item_type
+ , typename ci::lazy_list::make_traits<
+ ci::opt::hook< ci::lazy_list::member_hook<
+ offsetof( member_item_type, hMember ),
+ ci::opt::gc<rcu_type>
+ > >
+ , ci::opt::less< less >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< rcu_type, bucket_type,
+ typename ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, member_cmpmix )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::member_item_type member_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::hash_int hash_int;
+
+ struct list_traits : public ci::lazy_list::traits
+ {
+ typedef ci::lazy_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<rcu_type>> hook;
+ typedef typename TestFixture::template less<member_item_type> less;
+ typedef typename TestFixture::template cmp<member_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::LazyList< rcu_type, member_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef typename TestFixture::simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelLazySet, member_mutex )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::member_mutex_item_type member_mutex_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::hash_int hash_int;
+
+ struct list_traits : public ci::lazy_list::traits
+ {
+ typedef ci::lazy_list::member_hook< offsetof( member_mutex_item_type, hMember ), ci::opt::gc<rcu_type>, ci::opt::lock_type<std::mutex>> hook;
+ typedef typename TestFixture::template less<member_mutex_item_type> less;
+ typedef typename TestFixture::template cmp<member_mutex_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::LazyList< rcu_type, member_mutex_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef typename TestFixture::simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+
+// GCC 5: All test names should be written on single line, otherwise a runtime error will be encountered like as
+// "No test named <test_name> can be found in this test case"
+REGISTER_TYPED_TEST_CASE_P( IntrusiveMichaelLazySet,
+ base_cmp, base_less, base_cmpmix, base_mutex, member_cmp, member_less, member_cmpmix, member_mutex
+);
+
+
+#endif // CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_LAZY_RCU_H
+
\ No newline at end of file
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#ifndef CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_MICHAEL_RCU_H
+#define CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_MICHAEL_RCU_H
+
+#include "test_intrusive_set_rcu.h"
+#include <cds/intrusive/michael_list_rcu.h>
+#include <cds/intrusive/michael_set_rcu.h>
+
+namespace ci = cds::intrusive;
+
+template <class RCU>
+class IntrusiveMichaelSet: public cds_test::intrusive_set_rcu
+{
+ typedef cds_test::intrusive_set_rcu base_class;
+public:
+ typedef cds::urcu::gc<RCU> rcu_type;
+ typedef typename base_class::base_int_item< ci::michael_list::node<rcu_type>> base_item_type;
+ typedef typename base_class::member_int_item< ci::michael_list::node<rcu_type>> member_item_type;
+
+protected:
+ void SetUp()
+ {
+ RCU::Construct();
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ RCU::Destruct();
+ }
+};
+
+TYPED_TEST_CASE_P( IntrusiveMichaelSet );
+
+TYPED_TEST_P( IntrusiveMichaelSet, base_cmp )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::base_item_type base_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::template cmp<base_item_type> cmp;
+ typedef typename TestFixture::hash_int hash_int;
+
+ typedef ci::MichaelList< rcu_type
+ , base_item_type
+ , typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< rcu_type > > >
+ , ci::opt::compare< cmp >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< rcu_type, bucket_type,
+ typename ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelSet, base_less )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::base_item_type base_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::template less<base_item_type> less;
+ typedef typename TestFixture::hash_int hash_int;
+
+ typedef ci::MichaelList< rcu_type
+ , base_item_type
+ , typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::base_hook< ci::opt::gc< rcu_type >>>
+ , ci::opt::less< less >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< rcu_type, bucket_type,
+ typename ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelSet, base_cmpmix )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::base_item_type base_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::hash_int hash_int;
+
+ struct list_traits : public ci::michael_list::traits
+ {
+ typedef ci::michael_list::base_hook< ci::opt::gc<rcu_type>> hook;
+ typedef typename TestFixture::template less<base_item_type> less;
+ typedef typename TestFixture::template cmp<base_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::MichaelList< rcu_type, base_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef typename TestFixture::simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+
+TYPED_TEST_P( IntrusiveMichaelSet, member_cmp )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::member_item_type member_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::template cmp<member_item_type> cmp;
+ typedef typename TestFixture::hash_int hash_int;
+
+ typedef ci::MichaelList< rcu_type
+ , member_item_type
+ , typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook<
+ offsetof( member_item_type, hMember ),
+ ci::opt::gc<rcu_type>
+ >>
+ , ci::opt::compare< cmp >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< rcu_type, bucket_type,
+ typename ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelSet, member_less )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::member_item_type member_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::template less<member_item_type> less;
+ typedef typename TestFixture::hash_int hash_int;
+
+ typedef ci::MichaelList< rcu_type
+ , member_item_type
+ , typename ci::michael_list::make_traits<
+ ci::opt::hook< ci::michael_list::member_hook<
+ offsetof( member_item_type, hMember ),
+ ci::opt::gc<rcu_type>
+ > >
+ , ci::opt::less< less >
+ , ci::opt::disposer< mock_disposer >
+ >::type
+ > bucket_type;
+
+ typedef ci::MichaelHashSet< rcu_type, bucket_type,
+ typename ci::michael_set::make_traits<
+ ci::opt::hash< hash_int >
+ >::type
+ > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+TYPED_TEST_P( IntrusiveMichaelSet, member_cmpmix )
+{
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::member_item_type member_item_type;
+ typedef typename TestFixture::mock_disposer mock_disposer;
+ typedef typename TestFixture::hash_int hash_int;
+
+ struct list_traits : public ci::michael_list::traits
+ {
+ typedef ci::michael_list::member_hook< offsetof( member_item_type, hMember ), ci::opt::gc<rcu_type>> hook;
+ typedef typename TestFixture::template less<member_item_type> less;
+ typedef typename TestFixture::template cmp<member_item_type> compare;
+ typedef mock_disposer disposer;
+ };
+ typedef ci::MichaelList< rcu_type, member_item_type, list_traits > bucket_type;
+
+ struct set_traits : public ci::michael_set::traits
+ {
+ typedef hash_int hash;
+ typedef typename TestFixture::simple_item_counter item_counter;
+ };
+ typedef ci::MichaelHashSet< rcu_type, bucket_type, set_traits > set_type;
+
+ set_type s( TestFixture::kSize, 2 );
+ this->test( s );
+}
+
+
+
+// GCC 5: All test names should be written on single line, otherwise a runtime error will be encountered like as
+// "No test named <test_name> can be found in this test case"
+REGISTER_TYPED_TEST_CASE_P( IntrusiveMichaelSet,
+ base_cmp, base_less, base_cmpmix, member_cmp, member_less, member_cmpmix
+);
+
+
+#endif // CDSUNIT_SET_TEST_INTRUSIVE_MICHAEL_MICHAEL_RCU_H
+
\ No newline at end of file
class intrusive_set: public fixture
{
- protected:
+ public:
static size_t const kSize = 100;
struct stat
}
};
+ protected:
template <class Set>
void test( Set& s )
{
ASSERT_TRUE( s.empty() );
ASSERT_CONTAINER_SIZE( s, 0 );
+ size_t const nSetSize = kSize;
typedef typename Set::value_type value_type;
EXPECT_EQ( i.nFindCount, 2 );
}
ASSERT_FALSE( s.empty() );
- ASSERT_CONTAINER_SIZE( s, kSize );
+ ASSERT_CONTAINER_SIZE( s, nSetSize );
std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); });
ASSERT_TRUE( s.insert( i ));
}
ASSERT_FALSE( s.empty() );
- ASSERT_CONTAINER_SIZE( s, kSize );
+ ASSERT_CONTAINER_SIZE( s, nSetSize );
// Iterator test
for ( auto it = s.begin(); it != s.end(); ++it ) {
EXPECT_EQ( i.nFindCount, 0 );
gp = s.get( i );
- ASSERT_TRUE( gp );
+ ASSERT_FALSE( !gp );
++gp->nFindCount;
EXPECT_EQ( i.nFindCount, 1 );
gp = s.get( i.key() );
- ASSERT_TRUE( gp );
+ ASSERT_FALSE( !gp );
++gp->nFindCount;
EXPECT_EQ( i.nFindCount, 2 );
gp = s.get_with( other_item( i.key()), other_less());
- ASSERT_TRUE( gp );
+ ASSERT_FALSE( !gp );
++gp->nFindCount;
EXPECT_EQ( i.nFindCount, 3 );
gp = s.extract_with( other_item( i.key() ), other_less() );
break;
}
- ASSERT_TRUE( gp );
+ ASSERT_FALSE( !gp );
++gp->nEraseCount;
EXPECT_EQ( i.nEraseCount, 1 );
--- /dev/null
+/*
+ This file is a part of libcds - Concurrent Data Structures library
+
+ (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+ Source code repo: http://github.com/khizmax/libcds/
+ Download: http://sourceforge.net/projects/libcds/files/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef CDSUNIT_SET_TEST_INTRUSIVE_SET_NOGC_H
+#define CDSUNIT_SET_TEST_INTRUSIVE_SET_NOGC_H
+
+#include <cds_test/check_size.h>
+#include <cds_test/fixture.h>
+
+#include <cds/opt/hash.h>
+#include <functional> // ref
+
+// forward declaration
+namespace cds { namespace intrusive {}}
+
+namespace cds_test {
+
+ namespace ci = cds::intrusive;
+ namespace co = cds::opt;
+
+ class intrusive_set_nogc: public fixture
+ {
+ public:
+ static size_t const kSize = 100;
+
+ struct stat
+ {
+ unsigned int nFindCount ; // count of find-functor calling
+ unsigned int nUpdateNewCount;
+ unsigned int nUpdateCount;
+ unsigned int nDisposeCount;
+
+ stat()
+ {
+ clear_stat();
+ }
+
+ void clear_stat()
+ {
+ memset( this, 0, sizeof( *this ) );
+ }
+ };
+
+ template <typename Node>
+ struct base_int_item
+ : public Node
+ , public stat
+
+ {
+ int nKey;
+ int nVal;
+
+ base_int_item()
+ {}
+
+ explicit base_int_item( int key )
+ : nKey( key )
+ , nVal( key )
+ {}
+
+ base_int_item(int key, int val)
+ : nKey( key )
+ , nVal(val)
+ {}
+
+ base_int_item( base_int_item const& v )
+ : Node()
+ , stat()
+ , nKey( v.nKey )
+ , nVal( v.nVal )
+ {}
+
+ int key() const
+ {
+ return nKey;
+ }
+ };
+
+ template <typename Node>
+ struct member_int_item: public stat
+ {
+ int nKey;
+ int nVal;
+
+ Node hMember;
+
+ stat s;
+
+ member_int_item()
+ {}
+
+ explicit member_int_item( int key )
+ : nKey( key )
+ , nVal( key )
+ {}
+
+ member_int_item(int key, int val)
+ : nKey( key )
+ , nVal(val)
+ {}
+
+ member_int_item(member_int_item const& v )
+ : stat()
+ , nKey( v.nKey )
+ , nVal( v.nVal )
+ {}
+
+ int key() const
+ {
+ return nKey;
+ }
+ };
+
+ struct hash_int {
+ size_t operator()( int i ) const
+ {
+ return co::v::hash<int>()( i );
+ }
+ template <typename Item>
+ size_t operator()( const Item& i ) const
+ {
+ return (*this)( i.key() );
+ }
+ };
+
+ struct simple_item_counter {
+ size_t m_nCount;
+
+ simple_item_counter()
+ : m_nCount(0)
+ {}
+
+ size_t operator ++()
+ {
+ return ++m_nCount;
+ }
+
+ size_t operator --()
+ {
+ return --m_nCount;
+ }
+
+ void reset()
+ {
+ m_nCount = 0;
+ }
+
+ operator size_t() const
+ {
+ return m_nCount;
+ }
+
+ };
+
+
+ template <typename T>
+ struct less
+ {
+ bool operator ()(const T& v1, const T& v2 ) const
+ {
+ return v1.key() < v2.key();
+ }
+
+ template <typename Q>
+ bool operator ()(const T& v1, const Q& v2 ) const
+ {
+ return v1.key() < v2;
+ }
+
+ template <typename Q>
+ bool operator ()(const Q& v1, const T& v2 ) const
+ {
+ return v1 < v2.key();
+ }
+ };
+
+ template <typename T>
+ struct cmp {
+ int operator ()(const T& v1, const T& v2 ) const
+ {
+ if ( v1.key() < v2.key() )
+ return -1;
+ return v1.key() > v2.key() ? 1 : 0;
+ }
+
+ template <typename Q>
+ int operator ()(const T& v1, const Q& v2 ) const
+ {
+ if ( v1.key() < v2 )
+ return -1;
+ return v1.key() > v2 ? 1 : 0;
+ }
+
+ template <typename Q>
+ int operator ()(const Q& v1, const T& v2 ) const
+ {
+ if ( v1 < v2.key() )
+ return -1;
+ return v1 > v2.key() ? 1 : 0;
+ }
+ };
+
+ struct other_item {
+ int nKey;
+
+ explicit other_item( int k )
+ : nKey( k )
+ {}
+
+ int key() const
+ {
+ return nKey;
+ }
+ };
+
+ struct other_less {
+ template <typename Q, typename T>
+ bool operator()( Q const& lhs, T const& rhs ) const
+ {
+ return lhs.key() < rhs.key();
+ }
+ };
+
+ struct mock_disposer
+ {
+ template <typename T>
+ void operator ()( T * p )
+ {
+ ++p->nDisposeCount;
+ }
+ };
+
+ protected:
+ template <class Set>
+ void test( Set& s )
+ {
+ // Precondition: set is empty
+ // Postcondition: set is empty
+
+ ASSERT_TRUE( s.empty() );
+ ASSERT_CONTAINER_SIZE( s, 0 );
+ size_t const nSetSize = kSize;
+
+ typedef typename Set::value_type value_type;
+
+ std::vector< value_type > data;
+ std::vector< size_t> indices;
+ data.reserve( kSize );
+ indices.reserve( kSize );
+ for ( size_t key = 0; key < kSize; ++key ) {
+ data.push_back( value_type( static_cast<int>( key )));
+ indices.push_back( key );
+ }
+ shuffle( indices.begin(), indices.end() );
+
+ // insert/find
+ for ( auto idx : indices ) {
+ auto& i = data[ idx ];
+
+ ASSERT_TRUE( s.contains( i.nKey ) == nullptr );
+ ASSERT_TRUE( s.contains( i ) == nullptr );
+ ASSERT_TRUE( s.contains( other_item( i.key()), other_less()) == nullptr );
+ ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} ));
+ ASSERT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} ));
+
+ std::pair<bool, bool> updResult;
+
+ updResult = s.update( i, []( bool bNew, value_type&, value_type& )
+ {
+ ASSERT_TRUE( false );
+ }, false );
+ EXPECT_FALSE( updResult.first );
+ EXPECT_FALSE( updResult.second );
+
+ switch ( i.key() % 2 ) {
+ case 0:
+ ASSERT_TRUE( s.insert( i ));
+ ASSERT_FALSE( s.insert( i ));
+ EXPECT_EQ( i.nUpdateCount, 0 );
+ updResult = s.update( i, []( bool bNew, value_type& val, value_type& arg)
+ {
+ EXPECT_FALSE( bNew );
+ EXPECT_EQ( &val, &arg );
+ ++val.nUpdateCount;
+ }, false );
+ EXPECT_TRUE( updResult.first );
+ EXPECT_FALSE( updResult.second );
+ EXPECT_EQ( i.nUpdateCount, 1 );
+ break;
+ case 1:
+ EXPECT_EQ( i.nUpdateNewCount, 0 );
+ updResult = s.update( i, []( bool bNew, value_type& val, value_type& arg )
+ {
+ EXPECT_TRUE( bNew );
+ EXPECT_EQ( &val, &arg );
+ ++val.nUpdateNewCount;
+ });
+ EXPECT_TRUE( updResult.first );
+ EXPECT_TRUE( updResult.second );
+ EXPECT_EQ( i.nUpdateNewCount, 1 );
+ break;
+ }
+
+ ASSERT_TRUE( s.contains( i.nKey ) == &i );
+ ASSERT_TRUE( s.contains( i ) == &i );
+ ASSERT_TRUE( s.contains( other_item( i.key() ), other_less()) == &i );
+ EXPECT_EQ( i.nFindCount, 0 );
+ ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } ));
+ EXPECT_EQ( i.nFindCount, 1 );
+ ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } ));
+ EXPECT_EQ( i.nFindCount, 2 );
+ }
+ ASSERT_FALSE( s.empty() );
+ ASSERT_CONTAINER_SIZE( s, nSetSize );
+
+ std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); });
+
+ // Iterator test
+ for ( auto it = s.begin(); it != s.end(); ++it ) {
+ ++it->nFindCount;
+ }
+ for ( auto it = s.cbegin(); it != s.cend(); ++it ) {
+ EXPECT_EQ( it->nFindCount, 1 );
+ }
+ for ( auto& i : data ) {
+ EXPECT_EQ( i.nFindCount, 1 );
+ }
+
+ // clear test
+ for ( auto& i : data ) {
+ EXPECT_EQ( i.nDisposeCount, 0 );
+ }
+ s.clear();
+ for ( auto& i : data ) {
+ EXPECT_EQ( i.nDisposeCount, 1 );
+ }
+
+ ASSERT_TRUE( s.empty());
+ ASSERT_CONTAINER_SIZE( s, 0 );
+ ASSERT_TRUE( s.begin() == s.end() );
+ ASSERT_TRUE( s.cbegin() == s.cend() );
+ }
+ };
+
+} // namespace cds_test
+
+#endif // #ifndef CDSUNIT_SET_TEST_INTRUSIVE_SET_NOGC_H
rcu_lock l;
EXPECT_EQ( i.nFindCount, 0 );
rp = s.get( i );
- ASSERT_TRUE( rp );
+ ASSERT_FALSE( !rp );
++rp->nFindCount;
EXPECT_EQ( i.nFindCount, 1 );
rp = s.get( i.key() );
- ASSERT_TRUE( rp );
+ ASSERT_FALSE( !rp );
++rp->nFindCount;
EXPECT_EQ( i.nFindCount, 2 );
rp = s.get_with( other_item( i.key()), other_less());
- ASSERT_TRUE( rp );
+ ASSERT_FALSE( !rp );
++rp->nFindCount;
EXPECT_EQ( i.nFindCount, 3 );
}
if ( Set::c_bExtractLockExternal ) {
- rcu_lock l;
+ {
+ rcu_lock l;
+
+ EXPECT_EQ( i.nEraseCount, 0 );
+ switch ( i.key() % 3 ) {
+ case 0:
+ xp = s.extract( i.key());
+ break;
+ case 1:
+ xp = s.extract( i );
+ break;
+ case 2:
+ xp = s.extract_with( other_item( i.key() ), other_less() );
+ break;
+ }
+ ASSERT_FALSE( !xp );
+ ++xp->nEraseCount;
+ }
+ EXPECT_EQ( i.nEraseCount, 1 );
+ xp.release();
+
+ {
+ rcu_lock l;
- EXPECT_EQ( i.nEraseCount, 0 );
- switch ( i.key() % 3 ) {
- case 0:
- xp = s.extract( i.key());
- break;
- case 1:
xp = s.extract( i );
- break;
- case 2:
+ ASSERT_TRUE( !xp );
+ xp = s.extract( i.key() );
+ ASSERT_TRUE( !xp );
xp = s.extract_with( other_item( i.key() ), other_less() );
- break;
+ ASSERT_TRUE( !xp );
}
- ASSERT_TRUE( xp );
- ++xp->nEraseCount;
- EXPECT_EQ( i.nEraseCount, 1 );
-
- xp = s.extract( i );
- ASSERT_TRUE( !xp );
- xp = s.extract( i.key() );
- ASSERT_TRUE( !xp );
- xp = s.extract_with( other_item( i.key() ), other_less() );
- ASSERT_TRUE( !xp );
}
else {
EXPECT_EQ( i.nEraseCount, 0 );
xp = s.extract_with( other_item( i.key() ), other_less() );
break;
}
- ASSERT_TRUE( xp );
+ ASSERT_FALSE( !xp );
++xp->nEraseCount;
EXPECT_EQ( i.nEraseCount, 1 );