X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=test%2Funit%2Fset%2Fsplit_michael_dhp.cpp;h=ebf3df72c4a7475aeab2dff8830ad6ff4f2630ad;hb=056d289619d45ccf1055c18d63cb3bad072a71a0;hp=31b8dd9410c8eacb3f9aab1ece25fab35a55308f;hpb=7448008aa977fe42a83738fbbc63ce11d8ab86f9;p=libcds.git diff --git a/test/unit/set/split_michael_dhp.cpp b/test/unit/set/split_michael_dhp.cpp index 31b8dd94..ebf3df72 100644 --- a/test/unit/set/split_michael_dhp.cpp +++ b/test/unit/set/split_michael_dhp.cpp @@ -1,11 +1,11 @@ /* This file is a part of libcds - Concurrent Data Structures library - (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016 + (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2017 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: @@ -25,13 +25,14 @@ 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. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "test_set_hp.h" #include #include +#include namespace { namespace cc = cds::container; @@ -54,24 +55,24 @@ namespace { }; typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; - cds::gc::dhp::GarbageCollector::Construct( 16, set_type::c_nHazardPtrCount ); + cds::gc::dhp::smr::construct( set_type::c_nHazardPtrCount ); cds::threading::Manager::attachThread(); } void TearDown() { cds::threading::Manager::detachThread(); - cds::gc::dhp::GarbageCollector::Destruct(); + cds::gc::dhp::smr::destruct(); } }; TEST_F( SplitListMichaelSet_DHP, compare ) { - typedef cc::SplitListSet< gc_type, int_item, + typedef cc::SplitListSet< gc_type, int_item, typename cc::split_list::make_traits< cc::split_list::ordered_list< cc::michael_list_tag > , cds::opt::hash< hash_int > - , cc::split_list::ordered_list_traits< + , cc::split_list::ordered_list_traits< typename cc::michael_list::make_traits< cds::opt::compare< cmp > >::type @@ -85,11 +86,11 @@ namespace { TEST_F( SplitListMichaelSet_DHP, less ) { - typedef cc::SplitListSet< gc_type, int_item, + typedef cc::SplitListSet< gc_type, int_item, typename cc::split_list::make_traits< cc::split_list::ordered_list< cc::michael_list_tag > , cds::opt::hash< hash_int > - , cc::split_list::ordered_list_traits< + , cc::split_list::ordered_list_traits< typename cc::michael_list::make_traits< cds::opt::less< less > >::type @@ -103,11 +104,11 @@ namespace { TEST_F( SplitListMichaelSet_DHP, cmpmix ) { - typedef cc::SplitListSet< gc_type, int_item, + typedef cc::SplitListSet< gc_type, int_item, typename cc::split_list::make_traits< cc::split_list::ordered_list< cc::michael_list_tag > , cds::opt::hash< hash_int > - , cc::split_list::ordered_list_traits< + , cc::split_list::ordered_list_traits< typename cc::michael_list::make_traits< cds::opt::less< less > , cds::opt::compare< cmp > @@ -184,6 +185,26 @@ namespace { test( s ); } + TEST_F( SplitListMichaelSet_DHP, free_list ) + { + struct set_traits: public cc::split_list::traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::intrusive::FreeList free_list; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s( kSize, 2 ); + test( s ); + } + struct set_static_traits: public cc::split_list::traits { static bool const dynamic_bucket_table = false; @@ -209,4 +230,25 @@ namespace { test( s ); } + TEST_F( SplitListMichaelSet_DHP, static_bucket_table_free_list ) + { + struct set_traits: public set_static_traits + { + typedef cc::michael_list_tag ordered_list; + typedef hash_int hash; + typedef cds::atomicity::item_counter item_counter; + typedef cds::intrusive::FreeList free_list; + + struct ordered_list_traits: public cc::michael_list::traits + { + typedef cmp compare; + typedef cds::backoff::pause back_off; + }; + }; + typedef cc::SplitListSet< gc_type, int_item, set_traits > set_type; + + set_type s( kSize, 4 ); + test( s ); + } + } // namespace