/*
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:
typedef ci::LazyList< gc_type, base_item_type, list_traits > list_type;
typedef ci::MichaelHashSet< gc_type, list_type > 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( s );
}
+ TEST_F( IntrusiveMichaelLazySet_DHP, base_stat )
+ {
+ 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 mock_disposer disposer;
+ typedef ci::lazy_list::stat<> stat;
+ };
+ 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 );
+ EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
+ }
+
+ TEST_F( IntrusiveMichaelLazySet_DHP, base_wrapped_stat )
+ {
+ 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 mock_disposer disposer;
+ typedef ci::lazy_list::wrapped_stat<> stat;
+ };
+ 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 );
+ EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
+ }
TEST_F( IntrusiveMichaelLazySet_DHP, member_cmp )
{
test( s );
}
+ TEST_F( IntrusiveMichaelLazySet_DHP, member_stat )
+ {
+ 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 cmp<member_item_type> compare;
+ typedef mock_disposer disposer;
+ typedef ci::lazy_list::stat<> stat;
+ };
+ 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 );
+ EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
+ }
+
+ TEST_F( IntrusiveMichaelLazySet_DHP, member_wrapped_stat )
+ {
+ 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 cmp<member_item_type> compare;
+ typedef mock_disposer disposer;
+ typedef ci::lazy_list::wrapped_stat<> stat;
+ };
+ 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 );
+ EXPECT_GE( s.statistics().m_nInsertSuccess, 0u );
+ }
+
} // namespace