From: khizmax Date: Fri, 5 Feb 2016 21:29:32 +0000 (+0300) Subject: Tsigas' queue: replaced alignment option with padding one X-Git-Tag: v2.2.0~411 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2b69d9f0280822e81dba15849a8a72d57cafdf09;p=libcds.git Tsigas' queue: replaced alignment option with padding one Docfix --- diff --git a/cds/container/tsigas_cycle_queue.h b/cds/container/tsigas_cycle_queue.h index 4893e180..7f7f88f1 100644 --- a/cds/container/tsigas_cycle_queue.h +++ b/cds/container/tsigas_cycle_queue.h @@ -70,8 +70,8 @@ namespace cds { namespace container { */ typedef opt::v::relaxed_ordering memory_model; - /// Alignment for internal queue data. Default is \p opt::cache_line_alignment - enum { alignment = opt::cache_line_alignment }; + /// Padding for internal critical atomic data. Default is \p opt::cache_line_padding + enum { padding = opt::cache_line_padding }; }; /// Metafunction converting option list to \p tsigas_queue::traits @@ -84,7 +84,7 @@ namespace cds { namespace container { - \p opt::back_off - back-off strategy used, default is \p cds::backoff::empty. - \p opt::item_counter - the type of item counting feature. Default is \p cds::atomicity::empty_item_counter (item counting disabled) To enable item counting use \p cds::atomicity::item_counter - - \p opt::alignment - the alignment for internal queue data. Default is \p opt::cache_line_alignment + - \p opt::padding - padding for internal critical atomic data. Default is \p opt::cache_line_padding - \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). @@ -93,7 +93,7 @@ namespace cds { namespace container { typedef cds::container::TsigasCycleQueue< Foo, typename cds::container::tsigas_queue::make_traits< cds::opt::buffer< cds::opt::v::static_buffer< void *, 1024 >, - cds::opt::item_counte< cds::atomicity::item_counter > + cds::opt::item_counter< cds::atomicity::item_counter > >::type > myQueue; \endcode diff --git a/cds/intrusive/tsigas_cycle_queue.h b/cds/intrusive/tsigas_cycle_queue.h index 1fcac55a..1d1f5788 100644 --- a/cds/intrusive/tsigas_cycle_queue.h +++ b/cds/intrusive/tsigas_cycle_queue.h @@ -71,8 +71,8 @@ namespace cds { namespace intrusive { */ typedef opt::v::relaxed_ordering memory_model; - /// Alignment for internal queue data. Default is \p opt::cache_line_alignment - enum { alignment = opt::cache_line_alignment }; + /// Padding for internal critical atomic data. Default is \p opt::cache_line_padding + enum { padding = opt::cache_line_padding }; }; /// Metafunction converting option list to \p tsigas_queue::traits @@ -86,7 +86,7 @@ namespace cds { namespace intrusive { when dequeuing. - \p opt::item_counter - the type of item counting feature. Default is \p cds::atomicity::empty_item_counter (item counting disabled) To enable item counting use \p cds::atomicity::item_counter - - \p opt::alignment - the alignment for internal queue data. Default is \p opt::cache_line_alignment + - \p opt::padding - padding for internal critical atomic data. Default is \p opt::cache_line_padding - \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). @@ -192,17 +192,18 @@ namespace cds { namespace intrusive { protected: //@cond - typedef typename opt::details::alignment_setter< buffer, traits::alignment >::type aligned_buffer; typedef size_t index_type; - typedef typename opt::details::alignment_setter< atomics::atomic, traits::alignment >::type aligned_index; //@endcond protected: //@cond - buffer m_buffer ; ///< array of pointer T *, array size is equal to m_nCapacity+1 - aligned_index m_nHead ; ///< index of queue's head - aligned_index m_nTail ; ///< index of queue's tail - item_counter m_ItemCounter ; ///< item counter + buffer m_buffer ; ///< array of pointer T *, array size is equal to m_nCapacity+1 + typename opt::details::apply_padding< index_type, traits::padding >::padding_type pad1_; + atomics::atomic m_nHead ; ///< index of queue's head + typename opt::details::apply_padding< index_type, traits::padding >::padding_type pad2_; + atomics::atomic m_nTail ; ///< index of queue's tail + typename opt::details::apply_padding< index_type, traits::padding >::padding_type pad3_; + item_counter m_ItemCounter; ///< item counter //@endcond protected: diff --git a/cds/opt/options.h b/cds/opt/options.h index a23aea04..c2d39f3e 100644 --- a/cds/opt/options.h +++ b/cds/opt/options.h @@ -370,7 +370,7 @@ namespace opt { no_special_padding = 0, ///< no special padding cache_line_padding = 1, ///< use cache line size defined in cds/user_setup/cache_line.h - /// Apply padding only for tiny data of size less than required padding + /// Apply padding only for tiny data when data size is less than required padding /** The flag means that if your data size is less than the casheline size, the padding is applyed. Otherwise no padding will be applyed.