X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=cds%2Fcontainer%2Ftreiber_stack.h;h=a559d0cb6d55a8a2826e318069ac054213cef1fd;hb=df4d0c52b3eff17a49505093870a37ea8c9d565d;hp=3de4363180fd271b814a6078fca24dc1834d972f;hpb=67aa4799014772dc7ec890117cdcdb4d391eba70;p=libcds.git diff --git a/cds/container/treiber_stack.h b/cds/container/treiber_stack.h index 3de43631..a559d0cb 100644 --- a/cds/container/treiber_stack.h +++ b/cds/container/treiber_stack.h @@ -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,7 +25,7 @@ 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. */ #ifndef CDSLIB_CONTAINER_TREIBER_STACK_H @@ -87,12 +87,12 @@ namespace cds { namespace container { /// Buffer type for elimination array /** - Possible types are \p opt::v::static_buffer, \p opt::v::dynamic_buffer. + Possible types are \p opt::v::initialized_static_buffer, \p opt::v::initialized_dynamic_buffer. The buffer can be any size: \p Exp2 template parameter of those classes can be \p false. The size should be selected empirically for your application and hardware, there are no common rules for that. - Default is %opt::v::static_buffer< any_type, 4 > . + Default is %opt::v::initialized_static_buffer< any_type, 4 > . */ - typedef opt::v::static_buffer< int, 4 > buffer; + typedef opt::v::initialized_static_buffer< int, 4 > buffer; /// Random engine to generate a random position in elimination array typedef opt::v::c_rand random_engine; @@ -106,26 +106,26 @@ namespace cds { namespace container { /// Metafunction converting option list to \p TreiberStack traits /** Supported \p Options are: - - opt::allocator - allocator (like \p std::allocator) used for allocating stack nodes. Default is \ref CDS_DEFAULT_ALLOCATOR - - opt::back_off - back-off strategy used. If the option is not specified, the \p cds::backoff::Default is used. - - opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default) + - \p opt::allocator - allocator (like \p std::allocator) used for allocating stack nodes. Default is \ref CDS_DEFAULT_ALLOCATOR + - \p opt::back_off - back-off strategy used. If the option is not specified, the \p cds::backoff::Default is used. + - \p opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default) or \p opt::v::sequential_consistent (sequentially consisnent memory model). - - opt::item_counter - the type of item counting feature. Default is \p cds::atomicity::empty_item_counter, i.e. + - \p opt::item_counter - the type of item counting feature. Default is \p cds::atomicity::empty_item_counter, i.e. no item counting. Use \p cds::atomicity::item_counter to enable item counting. - - opt::stat - the type to gather internal statistics. + - \p opt::stat - the type to gather internal statistics. Possible option value are: \p treiber_stack::stat, \p treiber_stack::empty_stat (the default), user-provided class that supports \p %treiber_stack::stat interface. - - opt::enable_elimination - enable elimination back-off for the stack. Default value is \p false. + - \p opt::enable_elimination - enable elimination back-off for the stack. Default value is \p false. If elimination back-off is enabled, additional options can be specified: - - opt::buffer - a buffer type for elimination array, see \p opt::v::static_buffer, \p opt::v::dynamic_buffer. + - \p opt::buffer - an initialized buffer type for elimination array, see \p opt::v::initialized_static_buffer, \p opt::v::initialized_dynamic_buffer. The buffer can be any size: \p Exp2 template parameter of those classes can be \p false. The size should be selected empirically for your application and hardware, there are no common rules for that. - Default is %opt::v::static_buffer< any_type, 4 > . - - opt::random_engine - a random engine to generate a random position in elimination array. + Default is %opt::v::initialized_static_buffer< any_type, 4 > . + - \p opt::random_engine - a random engine to generate a random position in elimination array. Default is \p opt::v::c_rand. - - opt::elimination_backoff - back-off strategy to wait for elimination, default is \p cds::backoff::delay<> - - opt::lock_type - a lock type used in elimination back-off, default is \p cds::sync::spin. + - \p opt::elimination_backoff - back-off strategy to wait for elimination, default is \p cds::backoff::delay<> + - \p opt::lock_type - a lock type used in elimination back-off, default is \p cds::sync::spin. Example: declare %TreiberStack with item counting and internal statistics using \p %make_traits \code @@ -302,7 +302,7 @@ namespace cds { namespace container { /// Constructs empty stack and initializes elimination back-off data /** This form should be used if you use elimination back-off with dynamically allocated collision array, i.e - \p Options... contains cds::opt::buffer< cds::opt::v::dynamic_buffer >. + \p Options... contains cds::opt::buffer< cds::opt::v::initialized_dynamic_buffer >. \p nCollisionCapacity parameter specifies the capacity of collision array. */ TreiberStack( size_t nCollisionCapacity )