From adddd1652df4112294aa796d2fc8381a40af1262 Mon Sep 17 00:00:00 2001 From: khizmax Date: Wed, 1 Oct 2014 18:10:15 +0400 Subject: [PATCH] TreiberStack refactoring --- cds/container/treiber_stack.h | 6 ++++-- cds/intrusive/treiber_stack.h | 15 +++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/cds/container/treiber_stack.h b/cds/container/treiber_stack.h index 10ee11ef..61afd976 100644 --- a/cds/container/treiber_stack.h +++ b/cds/container/treiber_stack.h @@ -93,7 +93,7 @@ namespace cds { namespace container { intrusive::TreiberStack. Template arguments: - - \p GC - garbage collector type: gc::HP, gc::HRC, gc::PTB + - \p GC - garbage collector type: gc::HP, gc::PTB - \p T - type stored in the stack. It should be default-constructible, copy-constructible, assignable type. - \p Options - options @@ -201,12 +201,14 @@ namespace cds { namespace container { : base_class( nCollisionCapacity ) {} + TreiberStack( TreiberStack const& ) = delete; + /// Clears the stack on destruction ~TreiberStack() {} /// Push the item \p val on the stack - bool push( const value_type& val ) + bool push( value_type const& val ) { scoped_node_ptr p( alloc_node(val)); if ( base_class::push( *p )) { diff --git a/cds/intrusive/treiber_stack.h b/cds/intrusive/treiber_stack.h index 5e5083c1..6059aba3 100644 --- a/cds/intrusive/treiber_stack.h +++ b/cds/intrusive/treiber_stack.h @@ -278,19 +278,17 @@ namespace cds { namespace intrusive { This approach demonstrates sufficient performance under high load. Template arguments: - - \p GC - garbage collector type: gc::HP, gc::HRC, gc::PTB + - \p GC - garbage collector type: gc::HP, gc::PTB - \p T - type to be inserted into the stack - \p Options - options \p Options are: - opt::hook - hook used. Possible values are: single_link::base_hook, single_link::member_hook, single_link::traits_hook. If the option is not specified, single_link::base_hook<> is used. - For Gidenstam's gc::HRC, only single_link::base_hook is supported. - opt::back_off - back-off strategy used. If the option is not specified, the cds::backoff::Default is used. - opt::disposer - the functor used for dispose removed items. Default is opt::v::empty_disposer. This option is used only in \ref clear function. - opt::link_checker - the type of node's link fields checking. Default is \ref opt::debug_check_link. - Note: for gc::HRC garbage collector, link checking policy is always selected as \ref opt::always_check_link. - opt::memory_model - C++ memory ordering model. Can be opt::v::relaxed_ordering (relaxed memory model, the default) or opt::v::sequential_consistent (sequentially consisnent memory model). - opt::item_counter - the type of item counting feature. Default is \ref atomicity::empty_item_counter @@ -502,15 +500,6 @@ namespace cds { namespace intrusive { // GC and node_type::gc must be the same static_assert(( std::is_same::value ), "GC and node_type::gc must be the same"); - // For cds::gc::HRC, only base_hook is allowed - static_assert(( - std::conditional< - std::is_same::value, - std::is_same< typename hook::hook_type, opt::base_hook_tag >, - boost::true_type - >::type::value - ), "For cds::gc::HRC, only base_hook is allowed"); - static_assert( (!enable_elimination || std::is_same::value), "Random engine result type must be unsigned int" ); } @@ -538,6 +527,8 @@ namespace cds { namespace intrusive { init(); } + TreiberStack( TreiberStack const& ) = delete; + /// Destructor calls \ref cds_intrusive_TreiberStack_clear "clear" member function ~TreiberStack() { -- 2.34.1