</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="..\..\..\test\unit\main.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_dhp.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_hp.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_rcu_gpb.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_rcu_gpi.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\map\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\map\michael_lazy_rcu_shb.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_rcu_sht.cpp" />\r
<ClCompile Include="..\..\..\test\unit\map\michael_michael_dhp.cpp" />\r
<ClCompile Include="..\..\..\test\unit\map\michael_michael_hp.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\map\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\map\michael_michael_rcu_gpi.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\map\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\map\michael_michael_rcu_shb.cpp" />\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_michael_rcu_sht.cpp" />\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\..\..\test\unit\map\test_map.h" />\r
<ClInclude Include="..\..\..\test\unit\map\test_map_hp.h" />\r
+ <ClInclude Include="..\..\..\test\unit\map\test_map_rcu.h" />\r
+ <ClInclude Include="..\..\..\test\unit\map\test_michael_lazy_rcu.h" />\r
+ <ClInclude Include="..\..\..\test\unit\map\test_michael_michael_rcu.h" />\r
</ItemGroup>\r
<PropertyGroup Label="Globals">\r
<ProjectGuid>{42B7E892-DDDA-4D00-9AB7-378E0E7E9433}</ProjectGuid>\r
<ClCompile Include="..\..\..\test\unit\map\michael_michael_dhp.cpp">\r
<Filter>Source Files\MichaelMap</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_hp.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_dhp.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_michael_rcu_gpb.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_michael_rcu_gpi.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_michael_rcu_gpt.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_michael_rcu_shb.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_michael_rcu_sht.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_rcu_gpb.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_rcu_gpi.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_rcu_gpt.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_rcu_shb.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\..\..\test\unit\map\michael_lazy_rcu_sht.cpp">\r
+ <Filter>Source Files\MichaelMap</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\..\..\test\unit\map\test_map.h">\r
<ClInclude Include="..\..\..\test\unit\map\test_map_hp.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\..\..\test\unit\map\test_map_rcu.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\test\unit\map\test_michael_michael_rcu.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\..\..\test\unit\map\test_michael_lazy_rcu.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
set(CDSGTEST_MAP_SOURCES
../main.cpp
+ michael_lazy_hp.cpp
+ michael_lazy_dhp.cpp
+ michael_lazy_rcu_gpb.cpp
+ michael_lazy_rcu_gpi.cpp
+ michael_lazy_rcu_gpt.cpp
+ michael_lazy_rcu_shb.cpp
+ michael_lazy_rcu_sht.cpp
michael_michael_hp.cpp
michael_michael_dhp.cpp
+ michael_michael_rcu_gpb.cpp
+ michael_michael_rcu_gpi.cpp
+ michael_michael_rcu_gpt.cpp
+ michael_michael_rcu_shb.cpp
+ michael_michael_rcu_sht.cpp
)
include_directories(
--- /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_map_hp.h"
+
+#include <cds/container/lazy_kvlist_dhp.h>
+#include <cds/container/michael_map.h>
+
+namespace {
+
+ namespace cc = cds::container;
+ typedef cds::gc::DHP gc_type;
+
+ class MichaelLazyMap_DHP: public cds_test::container_map_hp
+ {
+ protected:
+ typedef cds_test::container_map_hp base_class;
+
+ void SetUp()
+ {
+ typedef cc::LazyKVList< gc_type, key_type, value_type > list_type;
+ typedef cc::MichaelHashMap< gc_type, list_type > map_type;
+
+ cds::gc::dhp::GarbageCollector::Construct( 16, map_type::c_nHazardPtrCount );
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ cds::gc::dhp::GarbageCollector::Destruct();
+ }
+ };
+
+ TEST_F( MichaelLazyMap_DHP, compare )
+ {
+ typedef cc::LazyKVList< gc_type, key_type, value_type,
+ typename cc::lazy_list::make_traits<
+ cds::opt::compare< cmp >
+ >::type
+ > list_type;
+
+ typedef cc::MichaelHashMap< gc_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< hash1 >
+ >::type
+ > map_type;
+
+ map_type m( kSize, 2 );
+ test( m );
+ }
+
+ TEST_F( MichaelLazyMap_DHP, less )
+ {
+ typedef cc::LazyKVList< gc_type, key_type, value_type,
+ typename cc::lazy_list::make_traits<
+ cds::opt::less< less >
+ >::type
+ > list_type;
+
+ typedef cc::MichaelHashMap< gc_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< hash1 >
+ >::type
+ > map_type;
+
+ map_type m( kSize, 1 );
+ test( m );
+ }
+
+ TEST_F( MichaelLazyMap_DHP, cmpmix )
+ {
+ typedef cc::LazyKVList< gc_type, key_type, value_type,
+ typename cc::lazy_list::make_traits<
+ cds::opt::less< less >
+ ,cds::opt::compare< cmp >
+ >::type
+ > list_type;
+
+ typedef cc::MichaelHashMap< gc_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< hash1 >
+ >::type
+ > map_type;
+
+ map_type m( kSize, 2 );
+ test( m );
+ }
+
+ TEST_F( MichaelLazyMap_DHP, backoff )
+ {
+ struct list_traits: public cc::lazy_list::traits
+ {
+ typedef cmp compare;
+ typedef cds::backoff::exponential<cds::backoff::pause, cds::backoff::yield> back_off;
+ };
+ typedef cc::LazyKVList< gc_type, key_type, value_type, list_traits > list_type;
+
+ struct map_traits: public cc::michael_map::traits
+ {
+ typedef hash1 hash;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef cc::MichaelHashMap< gc_type, list_type, map_traits > map_type;
+
+ map_type m( kSize, 4 );
+ test( m );
+ }
+
+ TEST_F( MichaelLazyMap_DHP, seq_cst )
+ {
+ struct list_traits: public cc::lazy_list::traits
+ {
+ typedef cmp compare;
+ typedef cds::backoff::yield back_off;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef cc::LazyKVList< gc_type, key_type, value_type, list_traits > list_type;
+
+ struct map_traits: public cc::michael_map::traits
+ {
+ typedef hash1 hash;
+ };
+ typedef cc::MichaelHashMap< gc_type, list_type, map_traits > map_type;
+
+ map_type m( kSize, 8 );
+ test( m );
+ }
+
+ TEST_F( MichaelLazyMap_DHP, mutex )
+ {
+ struct list_traits: public cc::lazy_list::traits
+ {
+ typedef cmp compare;
+ typedef cds::backoff::yield back_off;
+ typedef std::mutex lock_type;
+ };
+ typedef cc::LazyKVList< gc_type, key_type, value_type, list_traits > list_type;
+
+ struct map_traits: public cc::michael_map::traits
+ {
+ typedef hash1 hash;
+ };
+ typedef cc::MichaelHashMap< gc_type, list_type, map_traits > map_type;
+
+ map_type m( kSize, 2 );
+ test( m );
+ }
+
+} // 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 "test_map_hp.h"
+
+#include <cds/container/lazy_kvlist_hp.h>
+#include <cds/container/michael_map.h>
+
+namespace {
+
+ namespace cc = cds::container;
+ typedef cds::gc::HP gc_type;
+
+ class MichaelLazyMap_HP: public cds_test::container_map_hp
+ {
+ protected:
+ typedef cds_test::container_map_hp base_class;
+
+ void SetUp()
+ {
+ typedef cc::LazyKVList< gc_type, key_type, value_type > list_type;
+ typedef cc::MichaelHashMap< gc_type, list_type > map_type;
+
+ // +1 - for guarded_ptr and iterator
+ cds::gc::hp::GarbageCollector::Construct( map_type::c_nHazardPtrCount + 1, 1, 16 );
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ cds::gc::hp::GarbageCollector::Destruct( true );
+ }
+ };
+
+ TEST_F( MichaelLazyMap_HP, compare )
+ {
+ typedef cc::LazyKVList< gc_type, key_type, value_type,
+ typename cc::lazy_list::make_traits<
+ cds::opt::compare< cmp >
+ >::type
+ > list_type;
+
+ typedef cc::MichaelHashMap< gc_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< hash1 >
+ >::type
+ > map_type;
+
+ map_type m( kSize, 2 );
+ test( m );
+ }
+
+ TEST_F( MichaelLazyMap_HP, less )
+ {
+ typedef cc::LazyKVList< gc_type, key_type, value_type,
+ typename cc::lazy_list::make_traits<
+ cds::opt::less< less >
+ >::type
+ > list_type;
+
+ typedef cc::MichaelHashMap< gc_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< hash1 >
+ >::type
+ > map_type;
+
+ map_type m( kSize, 1 );
+ test( m );
+ }
+
+ TEST_F( MichaelLazyMap_HP, cmpmix )
+ {
+ typedef cc::LazyKVList< gc_type, key_type, value_type,
+ typename cc::lazy_list::make_traits<
+ cds::opt::less< less >
+ ,cds::opt::compare< cmp >
+ >::type
+ > list_type;
+
+ typedef cc::MichaelHashMap< gc_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< hash1 >
+ >::type
+ > map_type;
+
+ map_type m( kSize, 2 );
+ test( m );
+ }
+
+ TEST_F( MichaelLazyMap_HP, backoff )
+ {
+ struct list_traits: public cc::lazy_list::traits
+ {
+ typedef cmp compare;
+ typedef cds::backoff::exponential<cds::backoff::pause, cds::backoff::yield> back_off;
+ };
+ typedef cc::LazyKVList< gc_type, key_type, value_type, list_traits > list_type;
+
+ struct map_traits: public cc::michael_map::traits
+ {
+ typedef hash1 hash;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef cc::MichaelHashMap< gc_type, list_type, map_traits > map_type;
+
+ map_type m( kSize, 4 );
+ test( m );
+ }
+
+ TEST_F( MichaelLazyMap_HP, seq_cst )
+ {
+ struct list_traits: public cc::lazy_list::traits
+ {
+ typedef cmp compare;
+ typedef cds::backoff::yield back_off;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef cc::LazyKVList< gc_type, key_type, value_type, list_traits > list_type;
+
+ struct map_traits: public cc::michael_map::traits
+ {
+ typedef hash1 hash;
+ };
+ typedef cc::MichaelHashMap< gc_type, list_type, map_traits > map_type;
+
+ map_type m( kSize, 8 );
+ test( m );
+ }
+
+ TEST_F( MichaelLazyMap_HP, mutex )
+ {
+ struct list_traits: public cc::lazy_list::traits
+ {
+ typedef cmp compare;
+ typedef cds::backoff::yield back_off;
+ typedef std::mutex lock_type;
+ };
+ typedef cc::LazyKVList< gc_type, key_type, value_type, list_traits > list_type;
+
+ struct map_traits: public cc::michael_map::traits
+ {
+ typedef hash1 hash;
+ };
+ typedef cc::MichaelHashMap< gc_type, list_type, map_traits > map_type;
+
+ map_type m( kSize, 2 );
+ test( m );
+ }
+
+} // 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_michael_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, MichaelLazyMap, 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_michael_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_instant<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, MichaelLazyMap, 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_michael_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, MichaelLazyMap, 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_michael_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, MichaelLazyMap, rcu_implementation );
+
+#endif // 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_michael_lazy_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, MichaelLazyMap, rcu_implementation );
+
+#endif // 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/general_buffered.h>
+
+#include "test_michael_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPB, MichaelMap, 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_michael_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_instant<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPI, MichaelMap, 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_michael_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::general_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_GPT, MichaelMap, 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_michael_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_buffered<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHB, MichaelMap, rcu_implementation );
+
+#endif // 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_michael_michael_rcu.h"
+
+namespace {
+
+ typedef cds::urcu::signal_threaded<> rcu_implementation;
+
+} // namespace
+
+INSTANTIATE_TYPED_TEST_CASE_P( RCU_SHT, MichaelMap, rcu_implementation );
+
+#endif // CDS_URCU_SIGNAL_HANDLING_ENABLED
ASSERT_TRUE( m.empty());
ASSERT_CONTAINER_SIZE( m, 0 );
- typedef Map::value_type map_pair;
+ typedef typename Map::value_type map_pair;
+ size_t const kkSize = kSize;
std::vector<key_type> arrKeys;
- for ( int i = 0; i < static_cast<int>(kSize); ++i )
+ for ( int i = 0; i < static_cast<int>(kkSize); ++i )
arrKeys.push_back( key_type( i ));
shuffle( arrKeys.begin(), arrKeys.end());
std::vector< value_type > arrVals;
- for ( size_t i = 0; i < kSize; ++i ) {
+ for ( size_t i = 0; i < kkSize; ++i ) {
value_type val;
val.nVal = static_cast<int>( i );
val.strVal = std::to_string( i );
} ));
}
ASSERT_FALSE( m.empty() );
- ASSERT_CONTAINER_SIZE( m, kSize );
+ ASSERT_CONTAINER_SIZE( m, kkSize );
ASSERT_FALSE( m.begin() == m.end() );
ASSERT_FALSE( m.cbegin() == m.cend() );
ASSERT_TRUE( m.insert( i ));
ASSERT_FALSE( m.empty() );
- ASSERT_CONTAINER_SIZE( m, kSize );
+ ASSERT_CONTAINER_SIZE( m, kkSize );
m.clear();
ASSERT_TRUE( m.empty());
ASSERT_CONTAINER_SIZE( m, 0 );
- typedef Map::value_type map_pair;
+ typedef typename Map::value_type map_pair;
+ size_t const kkSize = base_class::kSize;
std::vector<key_type> arrKeys;
- for ( int i = 0; i < static_cast<int>(kSize); ++i )
+ for ( int i = 0; i < static_cast<int>(kkSize); ++i )
arrKeys.push_back( key_type( i ));
shuffle( arrKeys.begin(), arrKeys.end());
std::vector< value_type > arrVals;
- for ( size_t i = 0; i < kSize; ++i ) {
+ for ( size_t i = 0; i < kkSize; ++i ) {
value_type val;
val.nVal = static_cast<int>( i );
val.strVal = std::to_string( i );
for ( auto const& i : arrKeys )
ASSERT_TRUE( m.insert( i ) );
ASSERT_FALSE( m.empty() );
- ASSERT_CONTAINER_SIZE( m, kSize );
+ ASSERT_CONTAINER_SIZE( m, kkSize );
// iterators
size_t nCount = 0;
for ( auto it = m.begin(); it != m.end(); ++it ) {
EXPECT_EQ( it->second.nVal, 0 );
- it->second.nVal = it->first.nKey;
+ it->second.nVal = it->first.nKey * 2;
++nCount;
}
- EXPECT_EQ( nCount, kSize );
+ EXPECT_EQ( nCount, kkSize );
nCount = 0;
for ( auto it = m.cbegin(); it != m.cend(); ++it ) {
- EXPECT_EQ( it->second.nVal, it->first.nKey );
+ EXPECT_EQ( it->second.nVal, it->first.nKey * 2 );
++nCount;
}
- EXPECT_EQ( nCount, kSize );
+ EXPECT_EQ( nCount, kkSize );
// get/extract
typedef typename Map::guarded_ptr guarded_ptr;
--- /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_MAP_TEST_MAP_RCU_H
+#define CDSUNIT_MAP_TEST_MAP_RCU_H
+
+#include "test_map.h"
+
+namespace cds_test {
+
+ class container_map_rcu: public container_map
+ {
+ typedef container_map base_class;
+
+ protected:
+ template <class Map>
+ void test( Map& m )
+ {
+ // Precondition: map is empty
+ // Postcondition: map is empty
+
+ base_class::test( m );
+
+ ASSERT_TRUE( m.empty());
+ ASSERT_CONTAINER_SIZE( m, 0 );
+
+ typedef typename Map::value_type map_pair;
+ size_t const kkSize = base_class::kSize;
+
+ std::vector<key_type> arrKeys;
+ for ( int i = 0; i < static_cast<int>(kkSize); ++i )
+ arrKeys.push_back( key_type( i ));
+ shuffle( arrKeys.begin(), arrKeys.end());
+
+ std::vector< value_type > arrVals;
+ for ( size_t i = 0; i < kkSize; ++i ) {
+ value_type val;
+ val.nVal = static_cast<int>( i );
+ val.strVal = std::to_string( i );
+ arrVals.push_back( val );
+ }
+
+ for ( auto const& i : arrKeys )
+ ASSERT_TRUE( m.insert( i ) );
+ ASSERT_FALSE( m.empty() );
+ ASSERT_CONTAINER_SIZE( m, kkSize );
+
+ // iterators
+ size_t nCount = 0;
+ for ( auto it = m.begin(); it != m.end(); ++it ) {
+ EXPECT_EQ( it->second.nVal, 0 );
+ it->second.nVal = it->first.nKey * 2;
+ ++nCount;
+ }
+ EXPECT_EQ( nCount, kkSize );
+
+ nCount = 0;
+ for ( auto it = m.cbegin(); it != m.cend(); ++it ) {
+ EXPECT_EQ( it->second.nVal, it->first.nKey * 2 );
+ ++nCount;
+ }
+ EXPECT_EQ( nCount, kkSize );
+
+ typedef typename Map::exempt_ptr exempt_ptr;
+ typedef typename Map::raw_ptr raw_ptr;
+ typedef typename Map::rcu_lock rcu_lock;
+
+ // get/extract
+ shuffle( arrKeys.begin(), arrKeys.end() );
+
+ for ( auto const& i : arrKeys ) {
+ value_type const& val = arrVals.at( i.nKey );
+
+ {
+ rcu_lock l;
+ raw_ptr rp;
+
+ rp = m.get( i.nKey );
+ ASSERT_FALSE( !rp );
+ EXPECT_EQ( rp->first.nKey, i.nKey );
+ rp->second.nVal = rp->first.nKey * 2;
+
+ rp = m.get( i );
+ ASSERT_FALSE( !rp );
+ EXPECT_EQ( rp->first.nKey, i.nKey );
+ EXPECT_EQ( rp->second.nVal, rp->first.nKey * 2 );
+ rp->second.nVal = rp->first.nKey * 3;
+
+ rp = m.get_with( other_item( i.nKey ), other_less());
+ ASSERT_FALSE( !rp );
+ EXPECT_EQ( rp->first.nKey, i.nKey );
+ EXPECT_EQ( rp->second.nVal, rp->first.nKey * 3 );
+ rp->second.nVal = rp->first.nKey;
+ }
+
+ exempt_ptr xp;
+ if ( Map::c_bExtractLockExternal ) {
+ {
+ rcu_lock l;
+
+ switch ( i.nKey % 4 ) {
+ case 0:
+ xp = m.extract( i.nKey );
+ break;
+ case 1:
+ xp = m.extract( i );
+ break;
+ case 2:
+ xp = m.extract( val.strVal );
+ break;
+ case 3:
+ xp = m.extract_with( other_item( i.nKey ), other_less() );
+ break;
+ }
+ ASSERT_FALSE( !xp );
+ EXPECT_EQ( xp->first.nKey, i.nKey );
+ EXPECT_EQ( xp->second.nVal, xp->first.nKey );
+ }
+ xp.release();
+
+ {
+ rcu_lock l;
+
+ switch ( i.nKey % 4 ) {
+ case 0:
+ xp = m.extract( i.nKey );
+ break;
+ case 1:
+ xp = m.extract( i );
+ break;
+ case 2:
+ xp = m.extract( val.strVal );
+ break;
+ case 3:
+ xp = m.extract_with( other_item( i.nKey ), other_less() );
+ break;
+ }
+ EXPECT_TRUE( !xp );
+ }
+ }
+ else {
+ switch ( i.nKey % 4 ) {
+ case 0:
+ xp = m.extract( i.nKey );
+ break;
+ case 1:
+ xp = m.extract( i );
+ break;
+ case 2:
+ xp = m.extract( val.strVal );
+ break;
+ case 3:
+ xp = m.extract_with( other_item( i.nKey ), other_less());
+ break;
+ }
+ ASSERT_FALSE( !xp );
+ EXPECT_EQ( xp->first.nKey, i.nKey );
+ EXPECT_EQ( xp->second.nVal, xp->first.nKey );
+
+ switch ( i.nKey % 4 ) {
+ case 0:
+ xp = m.extract( i.nKey );
+ break;
+ case 1:
+ xp = m.extract( i );
+ break;
+ case 2:
+ xp = m.extract( val.strVal );
+ break;
+ case 3:
+ xp = m.extract_with( other_item( i.nKey ), other_less() );
+ break;
+ }
+ EXPECT_TRUE( !xp );
+ }
+
+ {
+ rcu_lock l;
+ raw_ptr rp;
+
+ rp = m.get( i.nKey );
+ ASSERT_TRUE( !rp );
+ rp = m.get( i );
+ ASSERT_TRUE( !rp );
+ rp = m.get_with( other_item( i.nKey ), other_less() );
+ ASSERT_TRUE( !rp );
+ }
+ }
+
+ ASSERT_TRUE( m.empty() );
+ ASSERT_CONTAINER_SIZE( m, 0 );
+ }
+ };
+
+} // namespace cds_test
+
+#endif // #ifndef CDSUNIT_MAP_TEST_MAP_H
--- /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_MAP_TEST_MICHAEL_LAZY_RCU_H
+#define CDSUNIT_MAP_TEST_MICHAEL_LAZY_RCU_H
+
+#include "test_map_rcu.h"
+#include <cds/container/lazy_kvlist_rcu.h>
+#include <cds/container/michael_map_rcu.h>
+
+namespace {
+ namespace cc = cds::container;
+
+ template <class RCU>
+ class MichaelLazyMap: public cds_test::container_map_rcu
+ {
+ typedef cds_test::container_map_rcu base_class;
+ public:
+ typedef cds::urcu::gc<RCU> rcu_type;
+
+ protected:
+ void SetUp()
+ {
+ RCU::Construct();
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ RCU::Destruct();
+ }
+ };
+
+ TYPED_TEST_CASE_P( MichaelLazyMap );
+
+ TYPED_TEST_P( MichaelLazyMap, compare )
+ {
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::key_type key_type;
+ typedef typename TestFixture::value_type value_type;
+
+ typedef cc::LazyKVList< rcu_type, key_type, value_type,
+ typename cc::lazy_list::make_traits<
+ cds::opt::compare< typename TestFixture::cmp >
+ >::type
+ > list_type;
+
+ typedef cc::MichaelHashMap< rcu_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< typename TestFixture::hash1 >
+ >::type
+ > map_type;
+
+ map_type m( TestFixture::kSize, 2 );
+ this->test( m );
+ }
+
+ TYPED_TEST_P( MichaelLazyMap, less )
+ {
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::key_type key_type;
+ typedef typename TestFixture::value_type value_type;
+
+ typedef cc::LazyKVList< rcu_type, key_type, value_type,
+ typename cc::lazy_list::make_traits<
+ cds::opt::less< typename TestFixture::less >
+ >::type
+ > list_type;
+
+ typedef cc::MichaelHashMap< rcu_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< typename TestFixture::hash1 >
+ >::type
+ > map_type;
+
+ map_type m( TestFixture::kSize, 2 );
+ this->test( m );
+ }
+
+ TYPED_TEST_P( MichaelLazyMap, cmpmix )
+ {
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::key_type key_type;
+ typedef typename TestFixture::value_type value_type;
+
+ struct list_traits : public cc::lazy_list::traits
+ {
+ typedef typename TestFixture::less less;
+ typedef typename TestFixture::cmp compare;
+ };
+ typedef cc::LazyKVList< rcu_type, key_type, value_type, list_traits > list_type;
+
+ typedef cc::MichaelHashMap< rcu_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< typename TestFixture::hash1 >
+ >::type
+ > map_type;
+
+ map_type m( TestFixture::kSize, 2 );
+ this->test( m );
+ }
+
+ TYPED_TEST_P( MichaelLazyMap, backoff )
+ {
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::key_type key_type;
+ typedef typename TestFixture::value_type value_type;
+
+ struct list_traits : public cc::lazy_list::traits
+ {
+ typedef typename TestFixture::cmp compare;
+ typedef cds::backoff::exponential<cds::backoff::pause, cds::backoff::yield> back_off;
+ };
+ typedef cc::LazyKVList< rcu_type, key_type, value_type, list_traits > list_type;
+
+ struct set_traits : public cc::michael_map::traits
+ {
+ typedef typename TestFixture::hash1 hash;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef cc::MichaelHashMap< rcu_type, list_type, set_traits >map_type;
+
+ map_type m( TestFixture::kSize, 4 );
+ this->test( m );
+ }
+
+ TYPED_TEST_P( MichaelLazyMap, seq_cst )
+ {
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::key_type key_type;
+ typedef typename TestFixture::value_type value_type;
+
+ struct list_traits : public cc::lazy_list::traits
+ {
+ typedef typename TestFixture::less less;
+ typedef cds::backoff::pause back_off;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef cc::LazyKVList< rcu_type, key_type, value_type, list_traits > list_type;
+
+ struct set_traits : public cc::michael_map::traits
+ {
+ typedef typename TestFixture::hash1 hash;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef cc::MichaelHashMap< rcu_type, list_type, set_traits >map_type;
+
+ map_type m( TestFixture::kSize, 4 );
+ this->test( m );
+ }
+
+ TYPED_TEST_P( MichaelLazyMap, mutex )
+ {
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::key_type key_type;
+ typedef typename TestFixture::value_type value_type;
+
+ struct list_traits : public cc::lazy_list::traits
+ {
+ typedef typename TestFixture::less less;
+ typedef cds::backoff::pause back_off;
+ typedef std::mutex lock_type;
+ };
+ typedef cc::LazyKVList< rcu_type, key_type, value_type, list_traits > list_type;
+
+ struct set_traits : public cc::michael_map::traits
+ {
+ typedef typename TestFixture::hash1 hash;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef cc::MichaelHashMap< rcu_type, list_type, set_traits >map_type;
+
+ map_type m( TestFixture::kSize, 4 );
+ this->test( m );
+ }
+
+
+ // 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( MichaelLazyMap,
+ compare, less, cmpmix, backoff, seq_cst, mutex
+ );
+} // namespace
+
+#endif // CDSUNIT_MAP_TEST_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_MAP_TEST_MICHAEL_MICHAEL_RCU_H
+#define CDSUNIT_MAP_TEST_MICHAEL_MICHAEL_RCU_H
+
+#include "test_map_rcu.h"
+#include <cds/container/michael_kvlist_rcu.h>
+#include <cds/container/michael_map_rcu.h>
+
+namespace {
+ namespace cc = cds::container;
+
+ template <class RCU>
+ class MichaelMap: public cds_test::container_map_rcu
+ {
+ typedef cds_test::container_map_rcu base_class;
+ public:
+ typedef cds::urcu::gc<RCU> rcu_type;
+
+ protected:
+ void SetUp()
+ {
+ RCU::Construct();
+ cds::threading::Manager::attachThread();
+ }
+
+ void TearDown()
+ {
+ cds::threading::Manager::detachThread();
+ RCU::Destruct();
+ }
+ };
+
+ TYPED_TEST_CASE_P( MichaelMap );
+
+ TYPED_TEST_P( MichaelMap, compare )
+ {
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::key_type key_type;
+ typedef typename TestFixture::value_type value_type;
+
+ typedef cc::MichaelKVList< rcu_type, key_type, value_type,
+ typename cc::michael_list::make_traits<
+ cds::opt::compare< typename TestFixture::cmp >
+ >::type
+ > list_type;
+
+ typedef cc::MichaelHashMap< rcu_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< typename TestFixture::hash1 >
+ >::type
+ > map_type;
+
+ map_type m( TestFixture::kSize, 2 );
+ this->test( m );
+ }
+
+ TYPED_TEST_P( MichaelMap, less )
+ {
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::key_type key_type;
+ typedef typename TestFixture::value_type value_type;
+
+ typedef cc::MichaelKVList< rcu_type, key_type, value_type,
+ typename cc::michael_list::make_traits<
+ cds::opt::less< typename TestFixture::less >
+ >::type
+ > list_type;
+
+ typedef cc::MichaelHashMap< rcu_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< typename TestFixture::hash1 >
+ >::type
+ > map_type;
+
+ map_type m( TestFixture::kSize, 2 );
+ this->test( m );
+ }
+
+ TYPED_TEST_P( MichaelMap, cmpmix )
+ {
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::key_type key_type;
+ typedef typename TestFixture::value_type value_type;
+
+ struct list_traits : public cc::michael_list::traits
+ {
+ typedef typename TestFixture::less less;
+ typedef typename TestFixture::cmp compare;
+ };
+ typedef cc::MichaelKVList< rcu_type, key_type, value_type, list_traits > list_type;
+
+ typedef cc::MichaelHashMap< rcu_type, list_type,
+ typename cc::michael_map::make_traits<
+ cds::opt::hash< typename TestFixture::hash1 >
+ >::type
+ > map_type;
+
+ map_type m( TestFixture::kSize, 2 );
+ this->test( m );
+ }
+
+ TYPED_TEST_P( MichaelMap, backoff )
+ {
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::key_type key_type;
+ typedef typename TestFixture::value_type value_type;
+
+ struct list_traits : public cc::michael_list::traits
+ {
+ typedef typename TestFixture::cmp compare;
+ typedef cds::backoff::exponential<cds::backoff::pause, cds::backoff::yield> back_off;
+ };
+ typedef cc::MichaelKVList< rcu_type, key_type, value_type, list_traits > list_type;
+
+ struct map_traits : public cc::michael_map::traits
+ {
+ typedef typename TestFixture::hash1 hash;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef cc::MichaelHashMap< rcu_type, list_type, map_traits >map_type;
+
+ map_type m( TestFixture::kSize, 4 );
+ this->test( m );
+ }
+
+ TYPED_TEST_P( MichaelMap, seq_cst )
+ {
+ typedef typename TestFixture::rcu_type rcu_type;
+ typedef typename TestFixture::key_type key_type;
+ typedef typename TestFixture::value_type value_type;
+
+ struct list_traits : public cc::michael_list::traits
+ {
+ typedef typename TestFixture::less less;
+ typedef cds::backoff::pause back_off;
+ typedef cds::opt::v::sequential_consistent memory_model;
+ };
+ typedef cc::MichaelKVList< rcu_type, key_type, value_type, list_traits > list_type;
+
+ struct map_traits : public cc::michael_map::traits
+ {
+ typedef typename TestFixture::hash1 hash;
+ typedef cds::atomicity::item_counter item_counter;
+ };
+ typedef cc::MichaelHashMap< rcu_type, list_type, map_traits >map_type;
+
+ map_type m( TestFixture::kSize, 4 );
+ this->test( m );
+ }
+
+
+ REGISTER_TYPED_TEST_CASE_P( MichaelMap,
+ compare, less, cmpmix, backoff, seq_cst
+ );
+}
+
+#endif // CDSUNIT_MAP_TEST_MICHAEL_MICHAEL_RCU_H
+
\ No newline at end of file