Intrusive TreiberStack refactoring, removing gc::HRC specialization
authorkhizmax <khizmax@gmail.com>
Thu, 2 Oct 2014 08:27:17 +0000 (12:27 +0400)
committerkhizmax <khizmax@gmail.com>
Thu, 2 Oct 2014 08:27:17 +0000 (12:27 +0400)
cds/intrusive/treiber_stack.h
projects/Win/vc12/hdr-test-stack.vcxproj
projects/source.test-hdr.mk
tests/test-hdr/stack/hdr_intrusive_elimination_stack_hp.cpp
tests/test-hdr/stack/hdr_intrusive_elimination_stack_hrc.cpp [deleted file]
tests/test-hdr/stack/hdr_intrusive_elimination_stack_ptb.cpp
tests/test-hdr/stack/hdr_intrusive_treiber_stack.h
tests/test-hdr/stack/hdr_intrusive_treiber_stack_hp.cpp
tests/test-hdr/stack/hdr_intrusive_treiber_stack_hrc.cpp [deleted file]
tests/test-hdr/stack/hdr_intrusive_treiber_stack_ptb.cpp

index 26231583a3cea0262acb302fa1c36a6358479ec4..de04aae154d77f76c83f454a90db433126f79514 100644 (file)
@@ -145,22 +145,106 @@ namespace cds { namespace intrusive {
         /// TreiberStack default type traits
         struct traits
         {
-            typedef cds::backoff::Default           back_off;       ///< Back-off strategy
-            typedef treiber_stack::base_hook<>      hook;           ///< Hook used
-            typedef opt::v::empty_disposer          disposer;       ///< Node disposer
-            typedef atomicity::empty_item_counter   item_counter;   ///< Item counting feature (by default, disabled)
-            typedef opt::v::relaxed_ordering        memory_model;   ///< Memory model (by default, relaxed)
-            typedef treiber_stack::empty_stat       stat;           ///< Internal statistics (by default, no internal statistics)
-            static CDS_CONSTEXPR_CONST opt::link_check_type link_checker = opt::debug_check_link; ///< Link checking, see cds::opt::link_checker
-
-            // Elimination back-off options
-            static CDS_CONSTEXPR_CONST bool enable_elimination = false; ///< Enable elimination (by default, it is disabled)
-            typedef cds::backoff::delay<>          elimination_backoff; ///< Back-off strategy for elimination
-            typedef opt::v::static_buffer< int, 4 > buffer;             ///< Elimination buffer type
-            typedef opt::v::c_rand                  random_engine;      ///< Random number generator for elimination
-            typedef cds::lock::Spin                 lock_type;          ///< Lock type for elimitation
+            /// Back-off strategy
+            typedef cds::backoff::Default           back_off;       
+
+            /// Hook, possible types are treiber_stack::base_hook, treiber_stack::member_hook, treiber_stack::traits_hook
+            typedef treiber_stack::base_hook<>      hook;
+
+            /// The functor used for dispose removed items. Default is opt::v::empty_disposer. This option is used only in \ref TreiberStack::clear function
+            typedef opt::v::empty_disposer          disposer;
+
+            /// Item counting feature; by default, disabled
+            typedef cds::atomicity::empty_item_counter   item_counter;   
+
+            /// C++ memory ordering model
+            /** 
+                Can be opt::v::relaxed_ordering (relaxed memory model, the default)
+                or opt::v::sequential_consistent (sequentially consisnent memory model).
+            */
+            typedef opt::v::relaxed_ordering        memory_model;
+
+            /// Internal statistics (by default, no internal statistics)
+            /**
+                Possible option value are: \ref treiber_stack::stat, \ref treiber_stack::empty_stat (the default),
+                user-provided class that supports treiber_stack::stat interface.
+            */
+            typedef treiber_stack::empty_stat       stat;
+
+            /// Link checking, see cds::opt::link_checker
+            static CDS_CONSTEXPR_CONST opt::link_check_type link_checker = opt::debug_check_link;
+
+            /** @name Elimination back-off traits
+                The following traits is used only if elimination enabled
+            */
+            ///@{
+
+            /// Enable elimination back-off; by default, it is disabled
+            static CDS_CONSTEXPR_CONST bool enable_elimination = false;
+
+            /// Back-off strategy to wait for elimination, default is cds::backoff::delay<>
+            typedef cds::backoff::delay<>          elimination_backoff;
+
+            /// Buffer type for elimination array
+            /**
+                Possible types are \p opt::v::static_buffer, \p opt::v::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 <tt> %opt::v::static_buffer< any_type, 4 > </tt>.
+            */
+            typedef opt::v::static_buffer< int, 4 > buffer;
+
+            /// Random engine to generate a random position in elimination array
+            typedef opt::v::c_rand  random_engine;
+
+            /// Lock type used in elimination, default is cds::lock::Spin
+            typedef cds::lock::Spin lock_type;
+
+            ///@}
+        };
+
+        /// Metafunction converting option list to \p TreiberStack traits
+        /**
+            This is a wrapper for <tt> cds::opt::make_options< type_traits, Options...> </tt>
+            Supported \p Options are:
+
+            - opt::hook - hook used. Possible values are: \p treiber_stack::base_hook, \p treiber_stack::member_hook, \p treiber_stack::traits_hook.
+                If the option is not specified, \p %treiber_stack::base_hook<> is used.
+            - opt::back_off - back-off strategy used. If the option is not specified, the \p cds::backoff::Default is used.
+            - opt::disposer - the functor used for dispose removed items. Default is \p opt::v::empty_disposer. This option is used only
+                in \p TreiberStack::clear function.
+            - opt::link_checker - the type of node's link fields checking. Default is \ref opt::debug_check_link.
+            - 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
+            - 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.
+
+            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.
+                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 <tt> %opt::v::static_buffer< any_type, 4 > </tt>.
+            - 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::lock::Spin.
+        */
+        template <typename... Options>
+        struct make_traits {
+#   ifdef CDS_DOXYGEN_INVOKED
+            typedef implementation_defined type;   ///< Metafunction result
+#   else
+            typedef typename cds::opt::make_options<
+                typename cds::opt::find_type_traits< traits, Options... >::type
+                , Options...
+            >::type   type;
+#   endif
         };
 
+
         //@cond
         namespace details {
 
@@ -339,38 +423,19 @@ namespace cds { namespace intrusive {
         This approach demonstrates sufficient performance under high load.
 
         Template arguments:
-        - \p GC - garbage collector type: gc::HP, gc::PTB
+        - \p GC - garbage collector type: gc::HP, gc::PTB. 
+            Garbage collecting schema must be consistent with the treiber_stack::node GC.
         - \p T - type to be inserted into the stack
-        - \p Options - options
-
-        \p Options are:
-        - opt::hook - hook used. Possible values are: treiber_stack::base_hook, treiber_stack::member_hook, treiber_stack::traits_hook.
-            If the option is not specified, <tt>treiber_stack::base_hook<></tt> is used.
-        - 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.
-        - 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
-        - opt::stat - the type to gather internal statistics.
-            Possible option value are: \ref treiber_stack::stat, \ref treiber_stack::empty_stat (the default),
-            user-provided class that supports treiber_stack::stat interface.
-        - opt::enable_elimination - enable elimination back-off for the stack. Default value is \p valse.
-
-        If elimination back-off is enabled (\p %cds::opt::enable_elimination< true >) additional options can be specified:
-        - opt::buffer - a buffer type for elimination array, see \p opt::v::static_buffer, \p opt::v::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 <tt> %opt::v::static_buffer< any_type, 4 > </tt>.
-        - opt::random_engine - a random engine to generate a random position in elimination array.
-            Default is opt::v::c_rand.
-        - opt::elimination_backoff - back-off strategy to wait for elimination, default is cds::backoff::delay<>
-        - opt::lock_type - a lock type used in elimination back-off, default is cds::lock::Spin.
-
-        Garbage collecting schema \p GC must be consistent with the treiber_stack::node GC.
-
-        Be careful when you want destroy an item popped, see \ref cds_intrusive_item_destroying "Destroying items of intrusive containers".
+        - \p Traits - stack traits, default is \p treiber_stack::traits. You can use \p treiber_stack::make_traits
+            metafunction to make your traits or just derive your traits from \p %treiber_stack::traits:
+            \code
+            struct myTraits: public cds::intrusive::treiber_stack::traits {
+                typedef cds::intrusive::treiber_stack::stat<> stat;
+            };
+            typedef cds::intrusive::TreiberStack< cds::gc::HP, Foo, myTraits > myStack;
+            \endcode
+
+        @note Be careful when you want destroy an item popped, see \ref cds_intrusive_item_destroying "Destroying items of intrusive containers".
 
         @anchor cds_intrusive_TreiberStack_examples
         \par Examples
@@ -398,8 +463,10 @@ namespace cds { namespace intrusive {
         // Stack with elimination back-off enabled
         typedef ci::TreiberStack< gc,
             myData,
-            ci::opt::hook< ci::treiber_stack::base_hook< gc > >,
-            cds::opt::enable_elimination< true >
+            typename ci::treiber_stack::make_traits< 
+                ci::opt::hook< ci::treiber_stack::base_hook< gc > >,
+                cds::opt::enable_elimination< true >
+            >::type
         > elimination_stack_t;
         \endcode
 
@@ -422,8 +489,19 @@ namespace cds { namespace intrusive {
             // ...
         };
 
-        typedef ci::TreiberStack< gc, myData, ci::opt::hook< ci::treiber_stack::base_hook< gc, tag1 > > stack1_t;
-        typedef ci::TreiberStack< gc, myData, ci::opt::hook< ci::treiber_stack::base_hook< gc, tag2 > > stack2_t;
+        typedef ci::TreiberStack< gc, 
+            myData, 
+            typename ci::treiber_stack::make_traits< 
+                ci::opt::hook< ci::treiber_stack::base_hook< gc, tag1 > >
+            >::type 
+        > stack1_t;
+
+        typedef ci::TreiberStack< gc, 
+            myData, 
+            typename ci::treiber_stack::make_traits<
+                ci::opt::hook< ci::treiber_stack::base_hook< gc, tag2 > 
+            >::type
+        > stack2_t;
 
         // You may add myData objects in the objects of type stack1_t and stack2_t independently
         void foo() {
@@ -462,82 +540,58 @@ namespace cds { namespace intrusive {
             // ...
         };
 
-        typedef ci::TreiberStack< gc, myData,
-            ci::opt::hook< ci::treiber_stack::member_hook< offsetof(myData, member_hook_), gc >
+        typedef ci::TreiberStack< gc, 
+            myData,
+            typename ci::treiber_stack::make_traits<
+                ci::opt::hook< ci::treiber_stack::member_hook< offsetof(myData, member_hook_), gc >
+            >::type
         > stack_t;
         \endcode
     */
-    template <typename GC, typename T, typename... Options>
+    template <typename GC, typename T, typename Traits = treiber_stack::traits >
     class TreiberStack
     {
-        //@cond
-        struct default_options
-        {
-            typedef cds::backoff::Default           back_off;
-            typedef treiber_stack::base_hook<>      hook;
-            typedef opt::v::empty_disposer          disposer;
-            typedef atomicity::empty_item_counter   item_counter;
-            typedef opt::v::relaxed_ordering        memory_model;
-            typedef treiber_stack::empty_stat       stat;
-            static CDS_CONSTEXPR_CONST opt::link_check_type link_checker = opt::debug_check_link;
-
-            // Elimination back-off options
-            static CDS_CONSTEXPR_CONST bool enable_elimination = false;
-            typedef cds::backoff::delay<>          elimination_backoff;
-            typedef opt::v::static_buffer< int, 4 > buffer;
-            typedef opt::v::c_rand                  random_engine;
-            typedef cds::lock::Spin                 lock_type;
-        };
-        //@endcond
-
-    public:
-        //@cond
-        typedef typename opt::make_options<
-            typename cds::opt::find_type_traits< default_options, Options... >::type
-            ,Options...
-        >::type   options;
-        //@endcond
-
     public:
         /// Rebind template arguments
-        template <typename GC2, typename T2, typename... Options2>
+        template <typename GC2, typename T2, typename Traits2>
         struct rebind {
-            typedef TreiberStack< GC2, T2, Options2...> other   ;   ///< Rebinding result
+            typedef TreiberStack< GC2, T2, Traits2 > other   ;   ///< Rebinding result
         };
 
     public:
-        typedef T  value_type   ;   ///< type of value stored in the stack
-        typedef typename options::hook      hook        ;   ///< hook type
-        typedef typename hook::node_type    node_type   ;   ///< node type
-        typedef typename options::disposer  disposer    ;   ///< disposer used
-        typedef typename get_node_traits< value_type, node_type, hook>::type node_traits ;    ///< node traits
-        typedef typename single_link::get_link_checker< node_type, options::link_checker >::type link_checker   ;   ///< link checker
-        typedef typename options::memory_model  memory_model      ;   ///< Memory ordering. See cds::opt::memory_model option
-        typedef typename options::item_counter item_counter ;   ///< Item counting policy used
-        typedef typename options::stat      stat        ;   ///< Internal statistics policy used
+        typedef GC  gc;                 ///< Garbage collector
+        typedef T       value_type;     ///< type of value stored in the stack
+        typedef Traits  traits;         ///< Stack traits
 
-        typedef GC  gc          ;   ///< Garbage collector
-        typedef typename options::back_off  back_off    ;   ///< back-off strategy
+        typedef typename traits::hook      hook;        ///< hook type
+        typedef typename traits::node_type node_type;   ///< node type
+        typedef typename traits::disposer  disposer;    ///< disposer used
+        typedef typename get_node_traits< value_type, node_type, hook>::type node_traits ;    ///< node traits
+        typedef typename single_link::get_link_checker< node_type, traits::link_checker >::type link_checker   ;   ///< link checker
+        typedef typename traits::memory_model   memory_model;   ///< Memory ordering. See cds::opt::memory_model option
+        typedef typename traits::item_counter   item_counter;   ///< Item counting policy used
+        typedef typename traits::stat           stat;           ///< Internal statistics policy used
+        typedef typename traits::back_off       back_off;       ///< back-off strategy
 
     public: // related to elimination back-off
 
         /// Elimination back-off is enabled or not
-        static CDS_CONSTEXPR_CONST bool enable_elimination = options::enable_elimination;
+        static CDS_CONSTEXPR_CONST bool enable_elimination = traits::enable_elimination;
         /// back-off strategy used to wait for elimination
-        typedef typename options::elimination_backoff elimination_backoff_type;
+        typedef typename traits::elimination_backoff elimination_backoff_type;
         /// Lock type used in elimination back-off
-        typedef typename options::lock_type elimination_lock_type;
+        typedef typename traits::lock_type elimination_lock_type;
         /// Random engine used in elimination back-off
-        typedef typename options::random_engine elimination_random_engine;
+        typedef typename traits::random_engine elimination_random_engine;
 
 
     protected:
-        typename node_type::atomic_node_ptr m_Top       ;   ///< Top of the stack
-        item_counter        m_ItemCounter   ;   ///< Item counter
-        stat                m_stat          ;   ///< Internal statistics
+        typename node_type::atomic_node_ptr m_Top;  ///< Top of the stack
+        item_counter        m_ItemCounter;          ///< Item counter
+        stat                m_stat;                 ///< Internal statistics
 
         //@cond
-        treiber_stack::details::elimination_backoff<enable_elimination, value_type, options> m_Backoff;
+        treiber_stack::details::elimination_backoff<enable_elimination, value_type, traits> m_Backoff;
 
         typedef intrusive::node_to_value<TreiberStack>  node_to_value;
         typedef treiber_stack::operation< value_type >  operation_desc;
@@ -585,6 +639,7 @@ namespace cds { namespace intrusive {
             init();
         }
 
+        /// %TreiberStack is not copy-constructible
         TreiberStack( TreiberStack const& ) = delete;
 
         /// Destructor calls \ref cds_intrusive_TreiberStack_clear "clear" member function
@@ -673,8 +728,7 @@ namespace cds { namespace intrusive {
         /** @anchor cds_intrusive_TreiberStack_clear
             For each removed item the disposer is called.
 
-            <b>Caution</b>
-            It is possible that after <tt>clear()</tt> the <tt>empty()</tt> returns \p false
+            @note It is possible that after <tt>clear()</tt> the <tt>empty()</tt> returns \p false
             if some other thread pushes an item into the stack during \p clear works
         */
         void clear()
@@ -705,7 +759,7 @@ namespace cds { namespace intrusive {
             The value returned depends on opt::item_counter option. For atomicity::empty_item_counter,
             this function always returns 0.
 
-            <b>Warning</b>: even if you use real item counter and it returns 0, this fact is not mean that the stack
+            @warning Even if you use real item counter and it returns 0, this fact is not mean that the stack
             is empty. To check emptyness use \ref empty() method.
         */
         size_t    size() const
index a923671f8a4002ad78c04c5178531793dbd0f83a..f9098a5b1060febc50d31d714e5979792af901e7 100644 (file)
     <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_elimination_stack_ptb.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_fcstack.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_elimination_stack_hp.cpp" />\r
-    <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_elimination_stack_hrc.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_elimination_stack_ptb.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_fcstack.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_treiber_stack_hp.cpp" />\r
-    <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_treiber_stack_hrc.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_intrusive_treiber_stack_ptb.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_treiber_stack_hp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\stack\hdr_treiber_stack_hrc.cpp" />\r
index 1f4a0180f7681242557c377fb6fa1c197462d7be..4013baf948157aeb10a2075ee33e0b02400e3ad5 100644 (file)
@@ -242,8 +242,6 @@ CDS_TESTHDR_SET := \
     tests/test-hdr/set/hdr_striped_hashset_vector.cpp 
 
 CDS_TESTHDR_STACK := \
-    tests/test-hdr/stack/hdr_intrusive_treiber_stack_hrc.cpp \
-    tests/test-hdr/stack/hdr_intrusive_elimination_stack_hrc.cpp \
     tests/test-hdr/stack/hdr_intrusive_fcstack.cpp \
     tests/test-hdr/stack/hdr_treiber_stack_hp.cpp \
     tests/test-hdr/stack/hdr_treiber_stack_hrc.cpp \
index 1a86bc3302f4c5c41ceac86738dffd92d1584391..f3c30e08222ed1de1f2cda2838987598a8b2314f 100644 (file)
@@ -12,128 +12,152 @@ namespace stack {
     namespace defs {
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::base_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+            >::type
         > Elimination_HP_default;
 
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::base_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Elimination_HP_default_relaxed;
 
         // HZP GC + base hook
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::base_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::base_hook<
-                    ci::opt::gc<cds::gc::HP>
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::hook<
+                    ci::single_link::base_hook<
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
+            >::type
         > Elimination_HP_base;
 
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::base_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::base_hook<
-                    ci::opt::gc<cds::gc::HP>
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::hook<
+                    ci::single_link::base_hook<
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
-            ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+                ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+            >::type
         > Elimination_HP_base_dyn;
 
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::base_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::base_hook<
-                    ci::opt::gc<cds::gc::HP>
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::hook<
+                    ci::single_link::base_hook<
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Elimination_HP_base_relaxed;
 
         // HZP GC + base hook + disposer
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::base_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HP> >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::HP> >
+                >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            >::type
         > Elimination_HP_base_disposer;
 
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::base_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HP> >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::HP> >
+                >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Elimination_HP_base_disposer_relaxed;
 
         // HZP GC + member hook
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::member_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
-                    ci::opt::gc<cds::gc::HP>
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
+            >::type
         > Elimination_HP_member;
 
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::member_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
-                    ci::opt::gc<cds::gc::HP>
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
-            ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+                ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+            >::type
         > Elimination_HP_member_dyn;
 
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::member_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
-                    ci::opt::gc<cds::gc::HP>
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Elimination_HP_member_relaxed;
 
         // HZP GC + member hook + disposer
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::member_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
-                    ci::opt::gc<cds::gc::HP>
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            >::type
         > Elimination_HP_member_disposer;
 
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::member_hook_item<cds::gc::HP>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
-                    ci::opt::gc<cds::gc::HP>
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Elimination_HP_member_disposer_relaxed;
     }
 
diff --git a/tests/test-hdr/stack/hdr_intrusive_elimination_stack_hrc.cpp b/tests/test-hdr/stack/hdr_intrusive_elimination_stack_hrc.cpp
deleted file mode 100644 (file)
index 4615110..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-//$$CDS-header$$
-
-#include "hdr_intrusive_treiber_stack.h"
-#include <cds/gc/hrc.h>
-#include <cds/intrusive/treiber_stack.h>
-
-namespace stack {
-
-#define TEST(X)      void TestIntrusiveStack::X() { test<defs::X>(); }
-#define TEST_DYN(X)  void TestIntrusiveStack::X() { test_elimination<defs::X>(); }
-
-    namespace defs {
-        // HRC GC
-        typedef cds::intrusive::TreiberStack< cds::gc::HRC,
-            TestIntrusiveStack::base_hook_item<cds::gc::HRC>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HRC> >
-            >
-            ,cds::opt::enable_elimination<true>
-        > Elimination_HRC_base;
-
-        typedef cds::intrusive::TreiberStack< cds::gc::HRC,
-            TestIntrusiveStack::base_hook_item<cds::gc::HRC>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HRC> >
-            >
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
-        > Elimination_HRC_base_dyn;
-
-        typedef cds::intrusive::TreiberStack< cds::gc::HRC,
-            TestIntrusiveStack::base_hook_item<cds::gc::HRC>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HRC> >
-            >
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
-        > Elimination_HRC_base_relaxed;
-
-        // HRC GC + disposer
-        typedef cds::intrusive::TreiberStack< cds::gc::HRC,
-            TestIntrusiveStack::base_hook_item<cds::gc::HRC>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HRC> >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-        > Elimination_HRC_base_disposer;
-
-        typedef cds::intrusive::TreiberStack< cds::gc::HRC,
-            TestIntrusiveStack::base_hook_item<cds::gc::HRC>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HRC> >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
-        > Elimination_HRC_base_disposer_relaxed;
-    }
-
-    TEST(Elimination_HRC_base)
-    TEST_DYN(Elimination_HRC_base_dyn)
-    TEST(Elimination_HRC_base_disposer)
-
-    TEST(Elimination_HRC_base_relaxed)
-    TEST(Elimination_HRC_base_disposer_relaxed)
-
-} // namespace stack
-
index 688581d248dceabf8444d57ceb0f84e433ee88c8..351f55bb22cc3d099f580c2225859251a925c904 100644 (file)
@@ -13,110 +13,130 @@ namespace stack {
         // PTB GC + base hook
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::base_hook_item<cds::gc::PTB>
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
-            >
+            , typename ci::treiber_stack::make_traits<
+                cds::opt::enable_elimination<true>
+                ,ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
+                >
+            >::type
         > Elimination_PTB_base;
 
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::base_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
-            >
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
+                >
+                ,cds::opt::enable_elimination<true>
+                ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+            >::type
         > Elimination_PTB_base_dyn;
 
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::base_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
-            >
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
+                >
+                ,cds::opt::enable_elimination<true>
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Elimination_PTB_base_relaxed;
 
         // PTB GC + base hook + disposer
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::base_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
-            >
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
+                >
+                ,cds::opt::enable_elimination<true>
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            >::type
         > Elimination_PTB_base_disposer;
 
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::base_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
-            >
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
+                >
+                ,cds::opt::enable_elimination<true>
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Elimination_PTB_base_disposer_relaxed;
 
         // PTB GC + member hook
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::member_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
-                    ci::opt::gc<cds::gc::PTB>
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
+                        ci::opt::gc<cds::gc::PTB>
+                    >
                 >
-            >
-            ,cds::opt::enable_elimination<true>
+                ,cds::opt::enable_elimination<true>
+            >::type
         > Elimination_PTB_member;
 
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::member_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
-                    ci::opt::gc<cds::gc::PTB>
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
+                        ci::opt::gc<cds::gc::PTB>
+                    >
                 >
-            >
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+                ,cds::opt::enable_elimination<true>
+                ,ci::opt::buffer< ci::opt::v::dynamic_buffer<void *> >
+            >::type
         > Elimination_PTB_member_dyn;
 
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::member_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
-                    ci::opt::gc<cds::gc::PTB>
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
+                        ci::opt::gc<cds::gc::PTB>
+                    >
                 >
-            >
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+                ,cds::opt::enable_elimination<true>
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Elimination_PTB_member_relaxed;
 
         // PTB GC + member hook + disposer
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::member_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
-                    ci::opt::gc<cds::gc::PTB>
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
+                        ci::opt::gc<cds::gc::PTB>
+                    >
                 >
-            >
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,cds::opt::enable_elimination<true>
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            >::type
         > Elimination_PTB_member_disposer;
 
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::member_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
-                    ci::opt::gc<cds::gc::PTB>
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
+                        ci::opt::gc<cds::gc::PTB>
+                    >
                 >
-            >
-            ,cds::opt::enable_elimination<true>
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+                ,cds::opt::enable_elimination<true>
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Elimination_PTB_member_disposer_relaxed;
     }
 
index 5d3f312d60461f76e5b143af5e286d9e9ceabb6b..6e86196fbd79d8f8d38fd7e33a890cdb0374c0b6 100644 (file)
@@ -115,8 +115,6 @@ namespace stack {
         void Treiber_HP_base_disposer();
         void Treiber_HP_member();
         void Treiber_HP_member_disposer();
-        void Treiber_HRC_base();
-        void Treiber_HRC_base_disposer();
         void Treiber_PTB_base();
         void Treiber_PTB_base_disposer();
         void Treiber_PTB_member();
@@ -127,8 +125,6 @@ namespace stack {
         void Treiber_HP_base_disposer_relaxed();
         void Treiber_HP_member_relaxed();
         void Treiber_HP_member_disposer_relaxed();
-        void Treiber_HRC_base_relaxed();
-        void Treiber_HRC_base_disposer_relaxed();
         void Treiber_PTB_base_relaxed();
         void Treiber_PTB_base_disposer_relaxed();
         void Treiber_PTB_member_relaxed();
@@ -141,9 +137,6 @@ namespace stack {
         void Elimination_HP_member();
         void Elimination_HP_member_dyn();
         void Elimination_HP_member_disposer();
-        void Elimination_HRC_base();
-        void Elimination_HRC_base_dyn();
-        void Elimination_HRC_base_disposer();
         void Elimination_PTB_base();
         void Elimination_PTB_base_dyn();
         void Elimination_PTB_base_disposer();
@@ -156,8 +149,6 @@ namespace stack {
         void Elimination_HP_base_disposer_relaxed();
         void Elimination_HP_member_relaxed();
         void Elimination_HP_member_disposer_relaxed();
-        void Elimination_HRC_base_relaxed();
-        void Elimination_HRC_base_disposer_relaxed();
         void Elimination_PTB_base_relaxed();
         void Elimination_PTB_base_disposer_relaxed();
         void Elimination_PTB_member_relaxed();
@@ -174,10 +165,6 @@ namespace stack {
             CPPUNIT_TEST(Treiber_HP_member_relaxed)
             CPPUNIT_TEST(Treiber_HP_member_disposer)
             CPPUNIT_TEST(Treiber_HP_member_disposer_relaxed)
-            CPPUNIT_TEST(Treiber_HRC_base)
-            CPPUNIT_TEST(Treiber_HRC_base_relaxed)
-            CPPUNIT_TEST(Treiber_HRC_base_disposer)
-            CPPUNIT_TEST(Treiber_HRC_base_disposer_relaxed)
             CPPUNIT_TEST(Treiber_PTB_base)
             CPPUNIT_TEST(Treiber_PTB_base_relaxed)
             CPPUNIT_TEST(Treiber_PTB_base_disposer)
@@ -199,11 +186,6 @@ namespace stack {
             CPPUNIT_TEST(Elimination_HP_member_relaxed)
             CPPUNIT_TEST(Elimination_HP_member_disposer)
             CPPUNIT_TEST(Elimination_HP_member_disposer_relaxed)
-            CPPUNIT_TEST(Elimination_HRC_base)
-            CPPUNIT_TEST(Elimination_HRC_base_dyn)
-            CPPUNIT_TEST(Elimination_HRC_base_relaxed)
-            CPPUNIT_TEST(Elimination_HRC_base_disposer)
-            CPPUNIT_TEST(Elimination_HRC_base_disposer_relaxed)
             CPPUNIT_TEST(Elimination_PTB_base)
             CPPUNIT_TEST(Elimination_PTB_base_dyn)
             CPPUNIT_TEST(Elimination_PTB_base_relaxed)
index cc73b7c97c45138e5825dbc021f90362793c49e6..3a982452575a3f917c8bcad09ecf2941c5a9b038 100644 (file)
@@ -15,7 +15,9 @@ namespace stack {
 
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::base_hook_item<cds::gc::HP>
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Treiber_HP_default_relaxed;
 
         // HZP GC + base hook
@@ -27,78 +29,111 @@ namespace stack {
                 >
             >
         > Treiber_HP_base;
-        typedef cds::intrusive::TreiberStack< cds::gc::HP,
-            TestIntrusiveStack::base_hook_item<cds::gc::HP>
-            ,ci::opt::hook<
-                ci::single_link::base_hook<
-                    ci::opt::gc<cds::gc::HP>
+
+        struct traits_Treiber_HP_base_relaxed
+            : ci::treiber_stack::make_traits <
+                ci::opt::hook<
+                    ci::single_link::base_hook<
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            > ::type
+        {};
+        typedef cds::intrusive::TreiberStack< cds::gc::HP,
+            TestIntrusiveStack::base_hook_item<cds::gc::HP>,
+            traits_Treiber_HP_base_relaxed
         > Treiber_HP_base_relaxed;
 
         // HZP GC + base hook + disposer
+        struct traits_Treiber_HP_base_disposer
+            : ci::treiber_stack::make_traits <
+                ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::HP> >
+                >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            >::type
+        {};
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
-            TestIntrusiveStack::base_hook_item<cds::gc::HP>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HP> >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            TestIntrusiveStack::base_hook_item<cds::gc::HP>,
+            traits_Treiber_HP_base_disposer
         > Treiber_HP_base_disposer;
 
         typedef cds::intrusive::TreiberStack< cds::gc::HP,
             TestIntrusiveStack::base_hook_item<cds::gc::HP>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HP> >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            ,typename ci::treiber_stack::make_traits <
+                ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::HP> >
+                >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Treiber_HP_base_disposer_relaxed;
 
         // HZP GC + member hook
-        typedef cds::intrusive::TreiberStack< cds::gc::HP,
-            TestIntrusiveStack::member_hook_item<cds::gc::HP>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
-                    ci::opt::gc<cds::gc::HP>
+        struct traits_Treiber_HP_member
+            : ci::treiber_stack::make_traits <
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
+            > ::type
+        {};
+        typedef cds::intrusive::TreiberStack< cds::gc::HP,
+            TestIntrusiveStack::member_hook_item<cds::gc::HP>,
+            traits_Treiber_HP_member
         > Treiber_HP_member;
 
-        typedef cds::intrusive::TreiberStack< cds::gc::HP,
-            TestIntrusiveStack::member_hook_item<cds::gc::HP>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
-                    ci::opt::gc<cds::gc::HP>
+        struct traits_Treiber_HP_member_relaxed
+            : ci::treiber_stack::make_traits <
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
+        {};
+        typedef cds::intrusive::TreiberStack< cds::gc::HP,
+            TestIntrusiveStack::member_hook_item<cds::gc::HP>,
+            traits_Treiber_HP_member_relaxed
         > Treiber_HP_member_relaxed;
 
         // HZP GC + member hook + disposer
-        typedef cds::intrusive::TreiberStack< cds::gc::HP,
-            TestIntrusiveStack::member_hook_item<cds::gc::HP>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
-                    ci::opt::gc<cds::gc::HP>
+        struct traits_Treiber_HP_member_disposer
+            : ci::treiber_stack::make_traits <
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            >::type
+        {};
+        typedef cds::intrusive::TreiberStack< cds::gc::HP,
+            TestIntrusiveStack::member_hook_item<cds::gc::HP>,
+            traits_Treiber_HP_member_disposer
         > Treiber_HP_member_disposer;
 
-        typedef cds::intrusive::TreiberStack< cds::gc::HP,
-            TestIntrusiveStack::member_hook_item<cds::gc::HP>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
-                    ci::opt::gc<cds::gc::HP>
+        struct traits_Treiber_HP_member_disposer_relaxed
+            : ci::treiber_stack::make_traits <
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::HP>, hMember),
+                        ci::opt::gc<cds::gc::HP>
+                    >
                 >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
+        {};
+        typedef cds::intrusive::TreiberStack< cds::gc::HP,
+            TestIntrusiveStack::member_hook_item<cds::gc::HP>,
+            traits_Treiber_HP_member_disposer_relaxed
         > Treiber_HP_member_disposer_relaxed;
     }}
 
diff --git a/tests/test-hdr/stack/hdr_intrusive_treiber_stack_hrc.cpp b/tests/test-hdr/stack/hdr_intrusive_treiber_stack_hrc.cpp
deleted file mode 100644 (file)
index a6746b9..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-//$$CDS-header$$
-
-#include "hdr_intrusive_treiber_stack.h"
-#include <cds/gc/hrc.h>
-#include <cds/intrusive/treiber_stack.h>
-
-namespace stack {
-
-#define TEST(X)     void TestIntrusiveStack::X() { test<defs::X>(); }
-
-    namespace defs {
-        // HRC GC
-        typedef cds::intrusive::TreiberStack< cds::gc::HRC,
-            TestIntrusiveStack::base_hook_item<cds::gc::HRC>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HRC> >
-            >
-        > Treiber_HRC_base;
-
-        typedef cds::intrusive::TreiberStack< cds::gc::HRC,
-            TestIntrusiveStack::base_hook_item<cds::gc::HRC>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HRC> >
-            >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
-        > Treiber_HRC_base_relaxed;
-
-        // HRC GC + disposer
-        typedef cds::intrusive::TreiberStack< cds::gc::HRC,
-            TestIntrusiveStack::base_hook_item<cds::gc::HRC>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HRC> >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-        > Treiber_HRC_base_disposer;
-
-        typedef cds::intrusive::TreiberStack< cds::gc::HRC,
-            TestIntrusiveStack::base_hook_item<cds::gc::HRC>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::HRC> >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
-        > Treiber_HRC_base_disposer_relaxed;
-    }
-
-    TEST(Treiber_HRC_base)
-    TEST(Treiber_HRC_base_disposer)
-
-    TEST(Treiber_HRC_base_relaxed)
-    TEST(Treiber_HRC_base_disposer_relaxed)
-
-} // namespace stack
-
index 9337c566edd02a83f3adace06f1da2a705982bc7..b1cdb51936c75a984929be31046c294e0d6c1bec 100644 (file)
@@ -12,81 +12,97 @@ namespace stack {
         // PTB GC + base hook
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::base_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
-            >
+            ,typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
+                >
+            >::type
         > Treiber_PTB_base;
 
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::base_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
-            >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            ,typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
+                >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Treiber_PTB_base_relaxed;
 
         // PTB GC + base hook + disposer
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::base_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            ,typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
+                >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            >::type
         > Treiber_PTB_base_disposer;
 
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::base_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            ,typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::base_hook< ci::opt::gc<cds::gc::PTB> >
+                >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Treiber_PTB_base_disposer_relaxed;
 
         // PTB GC + member hook
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::member_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
-                    ci::opt::gc<cds::gc::PTB>
+            ,typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
+                        ci::opt::gc<cds::gc::PTB>
+                    >
                 >
-            >
+            >::type
         > Treiber_PTB_member;
 
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::member_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
-                    ci::opt::gc<cds::gc::PTB>
+            ,typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
+                        ci::opt::gc<cds::gc::PTB>
+                    >
                 >
-            >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Treiber_PTB_member_relaxed;
 
         // PTB GC + member hook + disposer
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::member_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
-                    ci::opt::gc<cds::gc::PTB>
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
+                        ci::opt::gc<cds::gc::PTB>
+                    >
                 >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+            >::type
         > Treiber_PTB_member_disposer;
 
         typedef cds::intrusive::TreiberStack< cds::gc::PTB,
             TestIntrusiveStack::member_hook_item<cds::gc::PTB>
-            ,ci::opt::hook<
-                ci::single_link::member_hook<
-                    offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
-                    ci::opt::gc<cds::gc::PTB>
+            , typename ci::treiber_stack::make_traits<
+                ci::opt::hook<
+                    ci::single_link::member_hook<
+                        offsetof(TestIntrusiveStack::member_hook_item<cds::gc::PTB>, hMember),
+                        ci::opt::gc<cds::gc::PTB>
+                    >
                 >
-            >
-            ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
-            ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+                ,ci::opt::disposer< TestIntrusiveStack::faked_disposer >
+                ,ci::opt::memory_model< ci::opt::v::relaxed_ordering >
+            >::type
         > Treiber_PTB_member_disposer_relaxed;
     }