SegmentedQueue refactoring
authorkhizmax <khizmax@gmail.com>
Thu, 9 Oct 2014 10:43:55 +0000 (14:43 +0400)
committerkhizmax <khizmax@gmail.com>
Thu, 9 Oct 2014 10:43:55 +0000 (14:43 +0400)
18 files changed:
cds/container/msqueue.h
cds/container/segmented_queue.h
cds/intrusive/segmented_queue.h
change.log
projects/Win/vc12/hdr-test-queue.vcxproj
projects/Win/vc12/hdr-test-queue.vcxproj.filters
projects/source.test-hdr.mk
tests/test-hdr/queue/hdr_intrusive_segmented_queue.h
tests/test-hdr/queue/hdr_intrusive_segmented_queue_dhp.cpp [new file with mode: 0644]
tests/test-hdr/queue/hdr_intrusive_segmented_queue_hp.cpp
tests/test-hdr/queue/hdr_intrusive_segmented_queue_ptb.cpp [deleted file]
tests/test-hdr/queue/hdr_intrusive_singlelink_node.h [deleted file]
tests/test-hdr/queue/hdr_segmented_queue.h
tests/test-hdr/queue/hdr_segmented_queue_dhp.cpp [new file with mode: 0644]
tests/test-hdr/queue/hdr_segmented_queue_hp.cpp
tests/test-hdr/queue/hdr_segmented_queue_ptb.cpp [deleted file]
tests/unit/queue/intrusive_queue_type.h
tests/unit/queue/queue_type.h

index 42c5c5aa33317e086b87d2828ac936cc2cd9c6b3..c09d0a19c10fba5b053c012af2cfe3eaae41d4c3 100644 (file)
@@ -253,7 +253,7 @@ namespace cds { namespace container {
             return false;
         }
 
             return false;
         }
 
-        /// Enqueues \p data to the queue using a functor
+        /// Enqueues data to the queue using a functor
         /**
             \p Func is a functor called to create node.
             The functor \p f takes one argument - a reference to a new node of type \ref value_type :
         /**
             \p Func is a functor called to create node.
             The functor \p f takes one argument - a reference to a new node of type \ref value_type :
index f5c506c87bdcaae6a5665bae6f73d000b8aa33cc..73ae5a1174493214c7a058d825850e3215a0969a 100644 (file)
@@ -24,7 +24,7 @@ namespace cds { namespace container {
         typedef cds::intrusive::segmented_queue::empty_stat empty_stat;
 
         /// SegmentedQueue default type traits
         typedef cds::intrusive::segmented_queue::empty_stat empty_stat;
 
         /// SegmentedQueue default type traits
-        struct type_traits {
+        struct traits {
 
             /// Item allocator. Default is \ref CDS_DEFAULT_ALLOCATOR
             typedef CDS_DEFAULT_ALLOCATOR   node_allocator;
 
             /// Item allocator. Default is \ref CDS_DEFAULT_ALLOCATOR
             typedef CDS_DEFAULT_ALLOCATOR   node_allocator;
@@ -58,7 +58,7 @@ namespace cds { namespace container {
 
          /// Metafunction converting option list to traits for SegmentedQueue
         /**
 
          /// Metafunction converting option list to traits for SegmentedQueue
         /**
-            The metafunction can be useful if a few fields in \ref type_traits should be changed.
+            The metafunction can be useful if a few fields in \p segmented_queue::traits should be changed.
             For example:
             \code
             typedef cds::container::segmented_queue::make_traits<
             For example:
             \code
             typedef cds::container::segmented_queue::make_traits<
@@ -66,21 +66,21 @@ namespace cds { namespace container {
             >::type my_segmented_queue_traits;
             \endcode
             This code creates \p %SegmentedQueue type traits with item counting feature,
             >::type my_segmented_queue_traits;
             \endcode
             This code creates \p %SegmentedQueue type traits with item counting feature,
-            all other \p type_traits members left unchanged.
+            all other \p segmented_queue::traits members left unchanged.
 
             \p Options are:
             - \p opt::node_allocator - node allocator.
 
             \p Options are:
             - \p opt::node_allocator - node allocator.
-            - \p opt::stat - internal statistics, possible type: \ref stat, \ref empty_stat (the default)
-            - \p opt::item_counter - item counting feature. Note that atomicity::empty_item_counetr is not suitable
+            - \p opt::stat - internal statistics, possible type: \p segmented_queue::stat, \p segmented_queue::empty_stat (the default)
+            - \p opt::item_counter - item counting feature. Note that \p atomicity::empty_item_counetr is not suitable
                 for segmented queue.
             - \p opt::memory_model - memory model, default is \p opt::v::relaxed_ordering.
                 See option description for the full list of possible models
                 for segmented queue.
             - \p opt::memory_model - memory model, default is \p opt::v::relaxed_ordering.
                 See option description for the full list of possible models
-            - \p opt::alignment - the alignmentfor critical data, see option description for explanation
+            - \p opt::alignment - the alignment of critical data, see option description for explanation
             - \p opt::allocator - the allocator used to maintain segments.
             - \p opt::lock_type - a mutual exclusion lock type used to maintain internal list of allocated
                 segments. Default is \p cds::opt::Spin, \p std::mutex is also suitable.
             - \p opt::permutation_generator - a random permutation generator for sequence [0, quasi_factor),
             - \p opt::allocator - the allocator used to maintain segments.
             - \p opt::lock_type - a mutual exclusion lock type used to maintain internal list of allocated
                 segments. Default is \p cds::opt::Spin, \p std::mutex is also suitable.
             - \p opt::permutation_generator - a random permutation generator for sequence [0, quasi_factor),
-                default is cds::opt::v::random2_permutation<int>
+                default is \p cds::opt::v::random2_permutation<int>
         */
         template <typename... Options>
         struct make_traits {
         */
         template <typename... Options>
         struct make_traits {
@@ -88,7 +88,7 @@ namespace cds { namespace container {
             typedef implementation_defined type ;   ///< Metafunction result
 #   else
             typedef typename cds::opt::make_options<
             typedef implementation_defined type ;   ///< Metafunction result
 #   else
             typedef typename cds::opt::make_options<
-                typename cds::opt::find_type_traits< type_traits, Options... >::type
+                typename cds::opt::find_type_traits< traits, Options... >::type
                 ,Options...
             >::type   type;
 #   endif
                 ,Options...
             >::type   type;
 #   endif
@@ -114,7 +114,8 @@ namespace cds { namespace container {
                 }
             };
 
                 }
             };
 
-            struct intrusive_type_traits: public original_type_traits {
+            struct intrusive_type_traits: public original_type_traits 
+            {
                 typedef node_disposer   disposer;
             };
 
                 typedef node_disposer   disposer;
             };
 
@@ -161,11 +162,11 @@ namespace cds { namespace container {
         Template parameters:
         - \p GC - a garbage collector, possible types are cds::gc::HP, cds::gc::PTB
         - \p T - the type of values stored in the queue
         Template parameters:
         - \p GC - a garbage collector, possible types are cds::gc::HP, cds::gc::PTB
         - \p T - the type of values stored in the queue
-        - \p Traits - queue type traits, default is segmented_queue::type_traits.
-            segmented_queue::make_traits metafunction can be used to construct your
+        - \p Traits - queue type traits, default is \p segmented_queue::type_traits.
+            \p segmented_queue::make_traits metafunction can be used to construct your
             type traits.
     */
             type traits.
     */
-    template <class GC, typename T, typename Traits = segmented_queue::type_traits >
+    template <class GC, typename T, typename Traits = segmented_queue::traits >
     class SegmentedQueue:
 #ifdef CDS_DOXYGEN_INVOKED
         public cds::intrusive::SegmentedQueue< GC, T, Traits >
     class SegmentedQueue:
 #ifdef CDS_DOXYGEN_INVOKED
         public cds::intrusive::SegmentedQueue< GC, T, Traits >
@@ -178,11 +179,11 @@ namespace cds { namespace container {
         typedef typename maker::type base_class;
         //@endcond
     public:
         typedef typename maker::type base_class;
         //@endcond
     public:
-        typedef GC  gc          ;   ///< Garbage collector
-        typedef T   value_type  ;   ///< type of the value stored in the queue
-        typedef Traits options  ;   ///< Queue's traits
+        typedef GC  gc;         ///< Garbage collector
+        typedef T   value_type; ///< type of the value stored in the queue
+        typedef Traits traits;  ///< Queue traits
 
 
-        typedef typename options::node_allocator node_allocator;   ///< Node allocator
+        typedef typename traits::node_allocator node_allocator;   ///< Node allocator
         typedef typename base_class::memory_model  memory_model;   ///< Memory ordering. See cds::opt::memory_model option
         typedef typename base_class::item_counter  item_counter;   ///< Item counting policy, see cds::opt::item_counter option setter
         typedef typename base_class::stat          stat        ;   ///< Internal statistics policy
         typedef typename base_class::memory_model  memory_model;   ///< Memory ordering. See cds::opt::memory_model option
         typedef typename base_class::item_counter  item_counter;   ///< Item counting policy, see cds::opt::item_counter option setter
         typedef typename base_class::stat          stat        ;   ///< Internal statistics policy
@@ -211,11 +212,6 @@ namespace cds { namespace container {
         {
             return cxx_node_allocator().MoveNew( std::forward<Args>( args )... );
         }
         {
             return cxx_node_allocator().MoveNew( std::forward<Args>( args )... );
         }
-
-        struct dummy_disposer {
-            void operator()( value_type * p )
-            {}
-        };
         //@endcond
 
     public:
         //@endcond
 
     public:
@@ -246,45 +242,40 @@ namespace cds { namespace container {
             return false;
         }
 
             return false;
         }
 
-        /// Synonym for <tt>enqueue(value_type const&)</tt> function
-        bool push( value_type const& val )
-        {
-            return enqueue( val );
-        }
-
-        /// Inserts a new element at last segment of the queue using copy functor
+        /// Enqueues data to the queue using a functor
         /**
         /**
-            \p Func is a functor called to copy value \p data of type \p Q
-            which may be differ from type \ref value_type stored in the queue.
-            The functor's interface is:
+            \p Func is a functor called to create node.
+            The functor \p f takes one argument - a reference to a new node of type \ref value_type :
             \code
             \code
-            struct myFunctor {
-                void operator()(value_type& dest, Q const& data)
-                {
-                    // // Code to copy \p data to \p dest
-                    dest = data;
-                }
-            };
+            cds::container::SegmentedQueue< cds::gc::HP, Foo > myQueue;
+            Bar bar;
+            myQueue.enqueue_with( [&bar]( Foo& dest ) { dest = bar; } );
             \endcode
             \endcode
-            You may use \p boost:ref construction to pass functor \p f by reference.
         */
         */
-        template <typename Q, typename Func>
-        bool enqueue( Q const& data, Func f  )
+        template <typename Func>
+        bool enqueue_with( Func f )
         {
             scoped_node_ptr p( alloc_node() );
         {
             scoped_node_ptr p( alloc_node() );
-            f( *p, data );
-            if ( base_class::enqueue( *p )) {
+            f( *p );
+            if ( base_class::enqueue( *p ) ) {
                 p.release();
                 return true;
             }
             return false;
         }
 
                 p.release();
                 return true;
             }
             return false;
         }
 
-        /// Synonym for <tt>enqueue(Q const&, Func)</tt> function
-        template <typename Q, typename Func>
-        bool push( Q const& data, Func f )
+
+        /// Synonym for \p enqueue() member function
+        bool push( value_type const& val )
         {
         {
-            return enqueue( data, f );
+            return enqueue( val );
+        }
+
+        /// Synonym for \p enqueue_with() member function
+        template <typename Func>
+        bool push_with( Func f )
+        {
+            return enqueue_with( f );
         }
 
         /// Enqueues data of type \ref value_type constructed with <tt>std::forward<Args>(args)...</tt>
         }
 
         /// Enqueues data of type \ref value_type constructed with <tt>std::forward<Args>(args)...</tt>
@@ -299,54 +290,48 @@ namespace cds { namespace container {
             return false;
         }
 
             return false;
         }
 
-        /// Removes an element from first segment of the queue
+        /// Dequeues a value from the queue
+        /**
+            If queue is not empty, the function returns \p true, \p dest contains copy of
+            dequeued value. The assignment operator for type \ref value_type is invoked.
+            If queue is empty, the function returns \p false, \p dest is unchanged.
+        */
+        bool dequeue( value_type& dest )
+        {
+            return dequeue_with( [&dest]( value_type& src ) { dest = src; });
+        }
+
+        /// Dequeues a value using a functor
         /**
         /**
-            \p Func is a functor called to copy dequeued value to \p dest of type \p Q
-            which may be differ from type \ref value_type stored in the queue.
-            The functor's interface is:
+            \p Func is a functor called to copy dequeued value.
+            The functor takes one argument - a reference to removed node:
             \code
             \code
-            struct myFunctor {
-                void operator()(Q& dest, value_type const& data)
-                {
-                    // Code to copy \p data to \p dest
-                    dest = data;
-                }
-            };
+            cds:container::MSQueue< cds::gc::HP, Foo > myQueue;
+            Bar bar;
+            myQueue.dequeue_with( [&bar]( Foo& src ) { bar = std::move( src );});
             \endcode
             \endcode
-            You may use \p boost:ref construction to pass functor \p f by reference.
+            The functor is called only if the queue is not empty.
         */
         */
-        template <typename Q, typename Func>
-        bool dequeue( Q& dest, Func f )
+        template <typename Func>
+        bool dequeue_with( Func f )
         {
             value_type * p = base_class::dequeue();
             if ( p ) {
         {
             value_type * p = base_class::dequeue();
             if ( p ) {
-                f( dest, *p );
+                f( *p );
                 gc::template retire< typename maker::node_disposer >( p );
                 return true;
             }
             return false;
         }
 
                 gc::template retire< typename maker::node_disposer >( p );
                 return true;
             }
             return false;
         }
 
-        /// Synonym for <tt>dequeue( Q&, Func )</tt> function
+        /// Synonym for \p dequeue_with() function
         template <typename Q, typename Func>
         template <typename Q, typename Func>
-        bool pop( Q& dest, Func f )
-        {
-            return dequeue( dest, f );
-        }
-
-        /// Dequeues a value from the queue
-        /**
-            If queue is not empty, the function returns \p true, \p dest contains copy of
-            dequeued value. The assignment operator for type \ref value_type is invoked.
-            If queue is empty, the function returns \p false, \p dest is unchanged.
-        */
-        bool dequeue( value_type& dest )
+        bool pop_with( Func f )
         {
         {
-            typedef cds::details::trivial_assign<value_type, value_type> functor;
-            return dequeue( dest, functor() );
+            return dequeue_with( f );
         }
 
         }
 
-        /// Synonym for <tt>dequeue(value_type&)</tt> function
+        /// Synonym for \p dequeue() function
         bool pop( value_type& dest )
         {
             return dequeue( dest );
         bool pop( value_type& dest )
         {
             return dequeue( dest );
index 36e8abf188b91481bbfe2f668fccfad40eeec8f6..85a7796b0d691c03bd459171d6fe004ad594bb58 100644 (file)
@@ -24,7 +24,8 @@ namespace cds { namespace intrusive {
 
         /// SegmentedQueue internal statistics. May be used for debugging or profiling
         template <typename Counter = cds::atomicity::event_counter >
 
         /// SegmentedQueue internal statistics. May be used for debugging or profiling
         template <typename Counter = cds::atomicity::event_counter >
-        struct stat {
+        struct stat 
+        {
             typedef Counter  counter_type;  ///< Counter type
 
             counter_type    m_nPush;            ///< Push count
             typedef Counter  counter_type;  ///< Counter type
 
             counter_type    m_nPush;            ///< Push count
@@ -69,8 +70,8 @@ namespace cds { namespace intrusive {
             //@endcond
         };
 
             //@endcond
         };
 
-        /// SegmentedQueue default type traits
-        struct type_traits {
+        /// SegmentedQueue default traits
+        struct traits {
             /// Element disposer that is called when the item to be dequeued. Default is opt::v::empty_disposer (no disposer)
             typedef opt::v::empty_disposer disposer;
 
             /// Element disposer that is called when the item to be dequeued. Default is opt::v::empty_disposer (no disposer)
             typedef opt::v::empty_disposer disposer;
 
@@ -103,7 +104,7 @@ namespace cds { namespace intrusive {
 
         /// Metafunction converting option list to traits for SegmentedQueue
         /**
 
         /// Metafunction converting option list to traits for SegmentedQueue
         /**
-            The metafunction can be useful if a few fields in \ref type_traits should be changed.
+            The metafunction can be useful if a few fields in \p segmented_queue::traits should be changed.
             For example:
             \code
             typedef cds::intrusive::segmented_queue::make_traits<
             For example:
             \code
             typedef cds::intrusive::segmented_queue::make_traits<
@@ -111,21 +112,21 @@ namespace cds { namespace intrusive {
             >::type my_segmented_queue_traits;
             \endcode
             This code creates \p %SegmentedQueue type traits with item counting feature,
             >::type my_segmented_queue_traits;
             \endcode
             This code creates \p %SegmentedQueue type traits with item counting feature,
-            all other \p type_traits members left unchanged.
+            all other \p %segmented_queue::traits members left unchanged.
 
             \p Options are:
             - \p opt::disposer - the functor used for dispose removed items.
 
             \p Options are:
             - \p opt::disposer - the functor used for dispose removed items.
-            - \p opt::stat - internal statistics, possible type: \ref stat, \ref empty_stat (the default)
-            - \p opt::item_counter - item counting feature. Note that atomicity::empty_item_counetr is not suitable
+            - \p opt::stat - internal statistics, possible type: \p segmented_queue::stat, \p segmented_queue::empty_stat (the default)
+            - \p opt::item_counter - item counting feature. Note that \p atomicity::empty_item_counetr is not suitable
                 for segmented queue.
             - \p opt::memory_model - memory model, default is \p opt::v::relaxed_ordering.
                 See option description for the full list of possible models
             - \p opt::alignment - the alignment for critical data, see option description for explanation
                 for segmented queue.
             - \p opt::memory_model - memory model, default is \p opt::v::relaxed_ordering.
                 See option description for the full list of possible models
             - \p opt::alignment - the alignment for critical data, see option description for explanation
-            - \p opt::allocator - the allocator used t maintain segments.
+            - \p opt::allocator - the allocator to be used for maintaining segments.
             - \p opt::lock_type - a mutual exclusion lock type used to maintain internal list of allocated
                 segments. Default is \p cds::opt::Spin, \p std::mutex is also suitable.
             - \p opt::permutation_generator - a random permutation generator for sequence [0, quasi_factor),
             - \p opt::lock_type - a mutual exclusion lock type used to maintain internal list of allocated
                 segments. Default is \p cds::opt::Spin, \p std::mutex is also suitable.
             - \p opt::permutation_generator - a random permutation generator for sequence [0, quasi_factor),
-                default is cds::opt::v::random2_permutation<int>
+                default is \p cds::opt::v::random2_permutation<int>
         */
         template <typename... Options>
         struct make_traits {
         */
         template <typename... Options>
         struct make_traits {
@@ -133,7 +134,7 @@ namespace cds { namespace intrusive {
             typedef implementation_defined type ;   ///< Metafunction result
 #   else
             typedef typename cds::opt::make_options<
             typedef implementation_defined type ;   ///< Metafunction result
 #   else
             typedef typename cds::opt::make_options<
-                typename cds::opt::find_type_traits< type_traits, Options... >::type
+                typename cds::opt::find_type_traits< traits, Options... >::type
                 ,Options...
             >::type   type;
 #   endif
                 ,Options...
             >::type   type;
 #   endif
@@ -177,27 +178,27 @@ namespace cds { namespace intrusive {
         Template parameters:
         - \p GC - a garbage collector, possible types are cds::gc::HP, cds::gc::PTB
         - \p T - the type of values stored in the queue
         Template parameters:
         - \p GC - a garbage collector, possible types are cds::gc::HP, cds::gc::PTB
         - \p T - the type of values stored in the queue
-        - \p Traits - queue type traits, default is segmented_queue::type_traits.
-            segmented_queue::make_traits metafunction can be used to construct the
+        - \p Traits - queue type traits, default is \p segmented_queue::traits.
+            \p segmented_queue::make_traits metafunction can be used to construct the
             type traits.
 
         The queue stores the pointers to enqueued items so no special node hooks are needed.
     */
             type traits.
 
         The queue stores the pointers to enqueued items so no special node hooks are needed.
     */
-    template <class GC, typename T, typename Traits = segmented_queue::type_traits >
+    template <class GC, typename T, typename Traits = segmented_queue::traits >
     class SegmentedQueue
     {
     public:
     class SegmentedQueue
     {
     public:
-        typedef GC  gc          ;   ///< Garbage collector
-        typedef T   value_type  ;   ///< type of the value stored in the queue
-        typedef Traits options  ;   ///< Queue's traits
-
-        typedef typename options::disposer      disposer    ;   ///< value disposer, called only in \p clear() when the element to be dequeued
-        typedef typename options::allocator     allocator   ;   ///< Allocator maintaining the segments
-        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, see cds::opt::item_counter option setter
-        typedef typename options::stat          stat        ;   ///< Internal statistics policy
-        typedef typename options::lock_type     lock_type   ;   ///< Type of mutex for maintaining an internal list of allocated segments.
-        typedef typename options::permutation_generator permutation_generator; ///< Random permutation generator for sequence [0, quasi-factor)
+        typedef GC  gc;         ///< Garbage collector
+        typedef T   value_type; ///< type of the value stored in the queue
+        typedef Traits traits;  ///< Queue traits
+
+        typedef typename traits::disposer      disposer    ;   ///< value disposer, called only in \p clear() when the element to be dequeued
+        typedef typename traits::allocator     allocator;   ///< Allocator maintaining the segments
+        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, see cds::opt::item_counter option setter
+        typedef typename traits::stat          stat;   ///< Internal statistics policy
+        typedef typename traits::lock_type     lock_type;   ///< Type of mutex for maintaining an internal list of allocated segments.
+        typedef typename traits::permutation_generator permutation_generator; ///< Random permutation generator for sequence [0, quasi-factor)
 
         static const size_t m_nHazardPtrCount = 2 ; ///< Count of hazard pointer required for the algorithm
 
 
         static const size_t m_nHazardPtrCount = 2 ; ///< Count of hazard pointer required for the algorithm
 
@@ -234,7 +235,7 @@ namespace cds { namespace intrusive {
             segment(); //=delete
         };
 
             segment(); //=delete
         };
 
-        typedef typename opt::details::alignment_setter< atomics::atomic<segment *>, options::alignment >::type aligned_segment_ptr;
+        typedef typename opt::details::alignment_setter< atomics::atomic<segment *>, traits::alignment >::type aligned_segment_ptr;
         //@endcond
 
     protected:
         //@endcond
 
     protected:
index a457c7cf6695a6767fe48eafcb87c4d9706e71cd..3e8089d4ae6896e320abaf1be5853a3735aa1156 100644 (file)
@@ -10,6 +10,7 @@
              cds::container::BasketQueue
              cds::container::OptimisticQueue
              cds::container::RWQueue
              cds::container::BasketQueue
              cds::container::OptimisticQueue
              cds::container::RWQueue
+             cds::container::SegmentedQueue
 
 1.6.0 23.09.2014
     General release
 
 1.6.0 23.09.2014
     General release
index 461d1e33ac491ef756ec3168b7acfc25dc195143..1486e0ecb8fd90d274062c6d4d4428ecf7c6b8c9 100644 (file)
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_msqueue_hp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_optimisticqueue_dhp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_optimisticqueue_hp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_msqueue_hp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_optimisticqueue_dhp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_optimisticqueue_hp.cpp" />\r
+    <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue_dhp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue_hp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue_hp.cpp" />\r
-    <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue_ptb.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_tsigas_cycle_queue.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_vyukovmpmc_cycle_queue.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_moirqueue_dhp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_tsigas_cycle_queue.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_vyukovmpmc_cycle_queue.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_moirqueue_dhp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_optimistic_hp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_queue_register.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_rwqueue.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_optimistic_hp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_queue_register.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_rwqueue.cpp" />\r
+    <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue_dhp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue_hp.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue_hp.cpp" />\r
-    <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue_ptb.cpp" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_vyukov_mpmc_cyclic.cpp" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_msqueue.h" />\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue.h" />\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_vyukov_mpmc_cyclic.cpp" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_msqueue.h" />\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue.h" />\r
-    <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_singlelink_node.h" />\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_queue.h" />\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_queue_new.h" />\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue.h" />\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_queue.h" />\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_queue_new.h" />\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue.h" />\r
index e5089e339aabb3ea8f677ae896a189b716509047..605c32639c382dd712c24d4b707c935b993b38e0 100644 (file)
@@ -22,9 +22,6 @@
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue_hp.cpp">\r
       <Filter>intrusive</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue_hp.cpp">\r
       <Filter>intrusive</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue_ptb.cpp">\r
-      <Filter>intrusive</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_tsigas_cycle_queue.cpp">\r
       <Filter>intrusive</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_tsigas_cycle_queue.cpp">\r
       <Filter>intrusive</Filter>\r
     </ClCompile>\r
@@ -37,9 +34,6 @@
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue_hp.cpp">\r
       <Filter>container</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue_hp.cpp">\r
       <Filter>container</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue_ptb.cpp">\r
-      <Filter>container</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_vyukov_mpmc_cyclic.cpp">\r
       <Filter>container</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_vyukov_mpmc_cyclic.cpp">\r
       <Filter>container</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_optimistic_hp.cpp">\r
       <Filter>container</Filter>\r
     </ClCompile>\r
     <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_optimistic_hp.cpp">\r
       <Filter>container</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue_dhp.cpp">\r
+      <Filter>intrusive</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue_dhp.cpp">\r
+      <Filter>container</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_msqueue.h">\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_msqueue.h">\r
@@ -88,9 +88,6 @@
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue.h">\r
       <Filter>intrusive</Filter>\r
     </ClInclude>\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_segmented_queue.h">\r
       <Filter>intrusive</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_intrusive_singlelink_node.h">\r
-      <Filter>intrusive</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue.h">\r
       <Filter>container</Filter>\r
     </ClInclude>\r
     <ClInclude Include="..\..\..\tests\test-hdr\queue\hdr_segmented_queue.h">\r
       <Filter>container</Filter>\r
     </ClInclude>\r
index 8940eed18192ba0914643da7d022262b8893a524..2ae45dc5fc7718bf8976686c4a6c653851a59756 100644 (file)
@@ -119,7 +119,7 @@ CDS_TESTHDR_QUEUE := \
     tests/test-hdr/queue/hdr_queue_register.cpp \
     tests/test-hdr/queue/hdr_intrusive_fcqueue.cpp \
     tests/test-hdr/queue/hdr_intrusive_segmented_queue_hp.cpp \
     tests/test-hdr/queue/hdr_queue_register.cpp \
     tests/test-hdr/queue/hdr_intrusive_fcqueue.cpp \
     tests/test-hdr/queue/hdr_intrusive_segmented_queue_hp.cpp \
-    tests/test-hdr/queue/hdr_intrusive_segmented_queue_ptb.cpp \
+    tests/test-hdr/queue/hdr_intrusive_segmented_queue_dhp.cpp \
     tests/test-hdr/queue/hdr_intrusive_tsigas_cycle_queue.cpp \
     tests/test-hdr/queue/hdr_intrusive_vyukovmpmc_cycle_queue.cpp \
     tests/test-hdr/queue/hdr_basketqueue_hp.cpp \
     tests/test-hdr/queue/hdr_intrusive_tsigas_cycle_queue.cpp \
     tests/test-hdr/queue/hdr_intrusive_vyukovmpmc_cycle_queue.cpp \
     tests/test-hdr/queue/hdr_basketqueue_hp.cpp \
@@ -133,7 +133,7 @@ CDS_TESTHDR_QUEUE := \
     tests/test-hdr/queue/hdr_optimistic_dhp.cpp \
     tests/test-hdr/queue/hdr_rwqueue.cpp \
     tests/test-hdr/queue/hdr_segmented_queue_hp.cpp \
     tests/test-hdr/queue/hdr_optimistic_dhp.cpp \
     tests/test-hdr/queue/hdr_rwqueue.cpp \
     tests/test-hdr/queue/hdr_segmented_queue_hp.cpp \
-    tests/test-hdr/queue/hdr_segmented_queue_ptb.cpp \
+    tests/test-hdr/queue/hdr_segmented_queue_dhp.cpp \
     tests/test-hdr/queue/hdr_vyukov_mpmc_cyclic.cpp
 
 CDS_TESTHDR_SET := \
     tests/test-hdr/queue/hdr_vyukov_mpmc_cyclic.cpp
 
 CDS_TESTHDR_SET := \
index a448c3ee0c947202f5608b3abf3d45798dfa545c..5847af6e9a6b0ddeeabb36adbdba68ae121b851f 100644 (file)
@@ -185,10 +185,10 @@ namespace queue {
         void SegmQueue_HP_shuffle();
         void SegmQueue_HP_stat();
 
         void SegmQueue_HP_shuffle();
         void SegmQueue_HP_stat();
 
-        void SegmQueue_PTB();
-        void SegmQueue_PTB_mutex();
-        void SegmQueue_PTB_shuffle();
-        void SegmQueue_PTB_stat();
+        void SegmQueue_DHP();
+        void SegmQueue_DHP_mutex();
+        void SegmQueue_DHP_shuffle();
+        void SegmQueue_DHP_stat();
 
         CPPUNIT_TEST_SUITE(HdrIntrusiveSegmentedQueue)
             CPPUNIT_TEST( SegmQueue_HP )
 
         CPPUNIT_TEST_SUITE(HdrIntrusiveSegmentedQueue)
             CPPUNIT_TEST( SegmQueue_HP )
@@ -196,10 +196,10 @@ namespace queue {
             CPPUNIT_TEST( SegmQueue_HP_shuffle )
             CPPUNIT_TEST( SegmQueue_HP_stat )
 
             CPPUNIT_TEST( SegmQueue_HP_shuffle )
             CPPUNIT_TEST( SegmQueue_HP_stat )
 
-            CPPUNIT_TEST( SegmQueue_PTB )
-            CPPUNIT_TEST( SegmQueue_PTB_mutex )
-            CPPUNIT_TEST( SegmQueue_PTB_shuffle )
-            CPPUNIT_TEST( SegmQueue_PTB_stat )
+            CPPUNIT_TEST( SegmQueue_DHP )
+            CPPUNIT_TEST( SegmQueue_DHP_mutex )
+            CPPUNIT_TEST( SegmQueue_DHP_shuffle )
+            CPPUNIT_TEST( SegmQueue_DHP_stat )
         CPPUNIT_TEST_SUITE_END()
     };
 
         CPPUNIT_TEST_SUITE_END()
     };
 
diff --git a/tests/test-hdr/queue/hdr_intrusive_segmented_queue_dhp.cpp b/tests/test-hdr/queue/hdr_intrusive_segmented_queue_dhp.cpp
new file mode 100644 (file)
index 0000000..23f4cfe
--- /dev/null
@@ -0,0 +1,60 @@
+//$$CDS-header$$
+
+#include "hdr_intrusive_segmented_queue.h"
+#include <cds/intrusive/segmented_queue.h>
+#include <cds/gc/dhp.h>
+
+namespace queue {
+
+    void HdrIntrusiveSegmentedQueue::SegmQueue_DHP()
+    {
+        struct queue_traits : public cds::intrusive::segmented_queue::traits
+        {
+            typedef Disposer disposer;
+        };
+        typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type;
+
+        test<queue_type>();
+    }
+
+    void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_mutex()
+    {
+        struct queue_traits : public
+            cds::intrusive::segmented_queue::make_traits <
+                cds::intrusive::opt::disposer< Disposer >
+                ,cds::opt::lock_type < std::mutex >
+            > ::type
+        {};
+        typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type;
+
+        test<queue_type>();
+    }
+
+    void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_shuffle()
+    {
+        typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item,
+            cds::intrusive::segmented_queue::make_traits<
+                cds::intrusive::opt::disposer< Disposer >
+                ,cds::opt::item_counter< cds::atomicity::item_counter >
+                ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> >
+            >::type
+        > queue_type;
+
+        test<queue_type>();
+    }
+
+    void HdrIntrusiveSegmentedQueue::SegmQueue_DHP_stat()
+    {
+        typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, item,
+            cds::intrusive::segmented_queue::make_traits<
+                cds::intrusive::opt::disposer< Disposer >
+                ,cds::opt::item_counter< cds::atomicity::item_counter >
+                ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> >
+                ,cds::opt::stat< cds::intrusive::segmented_queue::stat<> >
+            >::type
+        > queue_type;
+
+        test<queue_type>();
+    }
+
+} // namespace queue
index f22d7d3ce651386d391333567a39868b630973b2..4eea7bd06ffdb098f2deefea7e59ee1bf547f0ae 100644 (file)
@@ -8,23 +8,24 @@ namespace queue {
 
     void HdrIntrusiveSegmentedQueue::SegmQueue_HP()
     {
 
     void HdrIntrusiveSegmentedQueue::SegmQueue_HP()
     {
-        typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item,
-            cds::intrusive::segmented_queue::make_traits<
-                cds::intrusive::opt::disposer< Disposer >
-            >::type
-        > queue_type;
+        struct queue_traits : public cds::intrusive::segmented_queue::traits
+        {
+            typedef Disposer disposer;
+        };
+        typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type;
 
         test<queue_type>();
     }
 
     void HdrIntrusiveSegmentedQueue::SegmQueue_HP_mutex()
     {
 
         test<queue_type>();
     }
 
     void HdrIntrusiveSegmentedQueue::SegmQueue_HP_mutex()
     {
-        typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item,
-            cds::intrusive::segmented_queue::make_traits<
+        struct queue_traits : public
+            cds::intrusive::segmented_queue::make_traits <
                 cds::intrusive::opt::disposer< Disposer >
                 cds::intrusive::opt::disposer< Disposer >
-                ,cds::opt::lock_type< std::mutex >
-            >::type
-        > queue_type;
+                ,cds::opt::lock_type < std::mutex >
+            > ::type
+        {};
+        typedef cds::intrusive::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type;
 
         test<queue_type>();
     }
 
         test<queue_type>();
     }
diff --git a/tests/test-hdr/queue/hdr_intrusive_segmented_queue_ptb.cpp b/tests/test-hdr/queue/hdr_intrusive_segmented_queue_ptb.cpp
deleted file mode 100644 (file)
index aa43ae2..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-//$$CDS-header$$
-
-#include "hdr_intrusive_segmented_queue.h"
-#include <cds/intrusive/segmented_queue.h>
-#include <cds/gc/ptb.h>
-
-namespace queue {
-
-    void HdrIntrusiveSegmentedQueue::SegmQueue_PTB()
-    {
-        typedef cds::intrusive::SegmentedQueue< cds::gc::PTB, item,
-            cds::intrusive::segmented_queue::make_traits<
-                cds::intrusive::opt::disposer< Disposer >
-            >::type
-        > queue_type;
-
-        test<queue_type>();
-    }
-
-    void HdrIntrusiveSegmentedQueue::SegmQueue_PTB_mutex()
-    {
-        typedef cds::intrusive::SegmentedQueue< cds::gc::PTB, item,
-            cds::intrusive::segmented_queue::make_traits<
-                cds::intrusive::opt::disposer< Disposer >
-                ,cds::opt::lock_type< std::mutex >
-            >::type
-        > queue_type;
-
-        test<queue_type>();
-    }
-
-    void HdrIntrusiveSegmentedQueue::SegmQueue_PTB_shuffle()
-    {
-        typedef cds::intrusive::SegmentedQueue< cds::gc::PTB, item,
-            cds::intrusive::segmented_queue::make_traits<
-                cds::intrusive::opt::disposer< Disposer >
-                ,cds::opt::item_counter< cds::atomicity::item_counter >
-                ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> >
-            >::type
-        > queue_type;
-
-        test<queue_type>();
-    }
-
-    void HdrIntrusiveSegmentedQueue::SegmQueue_PTB_stat()
-    {
-        typedef cds::intrusive::SegmentedQueue< cds::gc::PTB, item,
-            cds::intrusive::segmented_queue::make_traits<
-                cds::intrusive::opt::disposer< Disposer >
-                ,cds::opt::item_counter< cds::atomicity::item_counter >
-                ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> >
-                ,cds::opt::stat< cds::intrusive::segmented_queue::stat<> >
-            >::type
-        > queue_type;
-
-        test<queue_type>();
-    }
-
-} // namespace queue
diff --git a/tests/test-hdr/queue/hdr_intrusive_singlelink_node.h b/tests/test-hdr/queue/hdr_intrusive_singlelink_node.h
deleted file mode 100644 (file)
index a3d2f94..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-//$$CDS-header$$
-
-#ifndef CDSTEST_HDR_TEST_INTRUSIVE_SINGLELINK_NODE_H
-#define CDSTEST_HDR_TEST_INTRUSIVE_SINGLELINK_NODE_H
-
-#include <cds/intrusive/details/single_link_struct.h>
-
-namespace queue {
-    namespace ci = cds::intrusive;
-    namespace co = cds::opt;
-
-    template <typename GC>
-    struct base_hook_item: public ci::single_link::node< GC >
-    {
-        int nVal;
-        int nDisposeCount;
-
-        base_hook_item()
-            : nDisposeCount(0)
-        {}
-    };
-
-    template <typename GC>
-    struct member_hook_item
-    {
-        int nVal;
-        int nDisposeCount;
-        ci::single_link::node< GC > hMember;
-
-        member_hook_item()
-            : nDisposeCount(0)
-        {}
-    };
-
-} // queue
-
-#endif // #ifndef CDSTEST_HDR_TEST_INTRUSIVE_SINGLELINK_NODE_H
index f7621ad7eb2494f586bd0b713e460e4463969bc1..91ef3013e759aeb890c32617da00bac76416b1ac 100644 (file)
@@ -5,7 +5,6 @@
 
 #include "cppunit/cppunit_proxy.h"
 #include <cds/intrusive/details/base.h>
 
 #include "cppunit/cppunit_proxy.h"
 #include <cds/intrusive/details/base.h>
-#include <functional>   // ref
 #include "size_check.h"
 
 namespace queue {
 #include "size_check.h"
 
 namespace queue {
@@ -24,27 +23,6 @@ namespace queue {
             size_t  nVal;
         };
 
             size_t  nVal;
         };
 
-        struct push_functor {
-            void operator()( item& dest, other_item const& src ) const
-            {
-                dest.nVal = src.nVal;
-            }
-        };
-
-        struct pop_functor {
-            size_t nCount;
-
-            void operator()( other_item& dest, item const& src )
-            {
-                dest.nVal = src.nVal;
-                ++nCount;
-            }
-
-            pop_functor()
-                : nCount(0)
-            {}
-        };
-
         template <typename Queue>
         void test()
         {
         template <typename Queue>
         void test()
         {
@@ -108,26 +86,25 @@ namespace queue {
                     other_item itm;
                     itm.nVal = i;
                     if ( i & 1 ) {
                     other_item itm;
                     itm.nVal = i;
                     if ( i & 1 ) {
-                        CPPUNIT_ASSERT( q.push( itm, push_functor() ));
+                        CPPUNIT_ASSERT( q.push_with( [&itm]( item& dest ) { dest.nVal = itm.nVal; } ));
                     }
                     else {
                     }
                     else {
-                        CPPUNIT_ASSERT( q.enqueue( itm, push_functor() ));
+                        CPPUNIT_ASSERT( q.enqueue_with( [&itm]( item& dest ) { dest.nVal = itm.nVal; } ));
                     }
                     CPPUNIT_CHECK( misc::check_size( q, i + 1 ));
                     CPPUNIT_CHECK( !q.empty() );
                 }
 
                 {
                     }
                     CPPUNIT_CHECK( misc::check_size( q, i + 1 ));
                     CPPUNIT_CHECK( !q.empty() );
                 }
 
                 {
-                    pop_functor pf;
                     other_item v;
 
                     nCount = 0;
                     while ( !q.empty() ) {
                         if ( nCount & 1 ) {
                     other_item v;
 
                     nCount = 0;
                     while ( !q.empty() ) {
                         if ( nCount & 1 ) {
-                            CPPUNIT_ASSERT( q.pop( v, std::ref(pf) ));
+                            CPPUNIT_ASSERT( q.pop_with( [&v, &nCount]( item& src ) {v.nVal = src.nVal; ++nCount; } ));
                         }
                         else {
                         }
                         else {
-                            CPPUNIT_ASSERT( q.dequeue( v, std::ref(pf) ));
+                            CPPUNIT_ASSERT( q.dequeue_with( [&v, &nCount]( item& src ) {v.nVal = src.nVal; ++nCount; } ));
                         }
 
                         // It is possible c_nItemCount % quasi_factor() != 0
                         }
 
                         // It is possible c_nItemCount % quasi_factor() != 0
@@ -217,10 +194,10 @@ namespace queue {
         void SegmQueue_HP_shuffle();
         void SegmQueue_HP_stat();
 
         void SegmQueue_HP_shuffle();
         void SegmQueue_HP_stat();
 
-        void SegmQueue_PTB();
-        void SegmQueue_PTB_mutex();
-        void SegmQueue_PTB_shuffle();
-        void SegmQueue_PTB_stat();
+        void SegmQueue_DHP();
+        void SegmQueue_DHP_mutex();
+        void SegmQueue_DHP_shuffle();
+        void SegmQueue_DHP_stat();
 
         CPPUNIT_TEST_SUITE(HdrSegmentedQueue)
             CPPUNIT_TEST( SegmQueue_HP )
 
         CPPUNIT_TEST_SUITE(HdrSegmentedQueue)
             CPPUNIT_TEST( SegmQueue_HP )
@@ -228,10 +205,10 @@ namespace queue {
             CPPUNIT_TEST( SegmQueue_HP_shuffle )
             CPPUNIT_TEST( SegmQueue_HP_stat )
 
             CPPUNIT_TEST( SegmQueue_HP_shuffle )
             CPPUNIT_TEST( SegmQueue_HP_stat )
 
-            CPPUNIT_TEST( SegmQueue_PTB )
-            CPPUNIT_TEST( SegmQueue_PTB_mutex )
-            CPPUNIT_TEST( SegmQueue_PTB_shuffle )
-            CPPUNIT_TEST( SegmQueue_PTB_stat )
+            CPPUNIT_TEST( SegmQueue_DHP )
+            CPPUNIT_TEST( SegmQueue_DHP_mutex )
+            CPPUNIT_TEST( SegmQueue_DHP_shuffle )
+            CPPUNIT_TEST( SegmQueue_DHP_stat )
         CPPUNIT_TEST_SUITE_END()
 
     };
         CPPUNIT_TEST_SUITE_END()
 
     };
diff --git a/tests/test-hdr/queue/hdr_segmented_queue_dhp.cpp b/tests/test-hdr/queue/hdr_segmented_queue_dhp.cpp
new file mode 100644 (file)
index 0000000..cbe87dd
--- /dev/null
@@ -0,0 +1,52 @@
+//$$CDS-header$$
+
+#include "hdr_segmented_queue.h"
+#include <cds/container/segmented_queue.h>
+#include <cds/gc/dhp.h>
+
+namespace queue {
+
+    void HdrSegmentedQueue::SegmQueue_DHP()
+    {
+        typedef cds::container::SegmentedQueue< cds::gc::DHP, item > queue_type;
+        test<queue_type>();
+    }
+
+    void HdrSegmentedQueue::SegmQueue_DHP_mutex()
+    {
+        typedef cds::container::SegmentedQueue< cds::gc::DHP, item,
+            cds::container::segmented_queue::make_traits<
+                cds::opt::lock_type< std::mutex >
+            >::type
+        > queue_type;
+
+        test<queue_type>();
+    }
+
+    void HdrSegmentedQueue::SegmQueue_DHP_shuffle()
+    {
+        struct queue_traits : public cds::container::segmented_queue::traits
+        {
+            typedef cds::atomicity::item_counter item_counter;
+            typedef cds::opt::v::random_shuffle_permutation<> permutation_generator;
+        };
+        typedef cds::container::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type;
+
+        test<queue_type>();
+    }
+
+    void HdrSegmentedQueue::SegmQueue_DHP_stat()
+    {
+        struct queue_traits : public
+            cds::container::segmented_queue::make_traits <
+                cds::opt::item_counter< cds::atomicity::item_counter >
+                , cds::opt::permutation_generator< cds::opt::v::random_permutation<> >
+                , cds::opt::stat < cds::container::segmented_queue::stat<> >
+            > ::type
+        {};
+        typedef cds::container::SegmentedQueue< cds::gc::DHP, item, queue_traits > queue_type;
+
+        test<queue_type>();
+    }
+
+} // namespace queue
index 057df7a2eb13c13b4f61f9e6e6ba3b37736b91d5..7e2a72bc5fc891278b6b57944b55cd84ba7e009d 100644 (file)
@@ -9,7 +9,6 @@ namespace queue {
     void HdrSegmentedQueue::SegmQueue_HP()
     {
         typedef cds::container::SegmentedQueue< cds::gc::HP, item > queue_type;
     void HdrSegmentedQueue::SegmQueue_HP()
     {
         typedef cds::container::SegmentedQueue< cds::gc::HP, item > queue_type;
-
         test<queue_type>();
     }
 
         test<queue_type>();
     }
 
@@ -26,25 +25,26 @@ namespace queue {
 
     void HdrSegmentedQueue::SegmQueue_HP_shuffle()
     {
 
     void HdrSegmentedQueue::SegmQueue_HP_shuffle()
     {
-        typedef cds::container::SegmentedQueue< cds::gc::HP, item,
-            cds::container::segmented_queue::make_traits<
-                cds::opt::item_counter< cds::atomicity::item_counter >
-                ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> >
-            >::type
-        > queue_type;
+        struct queue_traits : public cds::container::segmented_queue::traits
+        {
+            typedef cds::atomicity::item_counter item_counter;
+            typedef cds::opt::v::random_shuffle_permutation<> permutation_generator;
+        };
+        typedef cds::container::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type;
 
         test<queue_type>();
     }
 
     void HdrSegmentedQueue::SegmQueue_HP_stat()
     {
 
         test<queue_type>();
     }
 
     void HdrSegmentedQueue::SegmQueue_HP_stat()
     {
-        typedef cds::container::SegmentedQueue< cds::gc::HP, item,
-            cds::container::segmented_queue::make_traits<
+        struct queue_traits : public
+            cds::container::segmented_queue::make_traits <
                 cds::opt::item_counter< cds::atomicity::item_counter >
                 cds::opt::item_counter< cds::atomicity::item_counter >
-                ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> >
-                ,cds::opt::stat< cds::container::segmented_queue::stat<> >
-            >::type
-        > queue_type;
+                , cds::opt::permutation_generator< cds::opt::v::random_permutation<> >
+                , cds::opt::stat < cds::container::segmented_queue::stat<> >
+            > ::type
+        {};
+        typedef cds::container::SegmentedQueue< cds::gc::HP, item, queue_traits > queue_type;
 
         test<queue_type>();
     }
 
         test<queue_type>();
     }
diff --git a/tests/test-hdr/queue/hdr_segmented_queue_ptb.cpp b/tests/test-hdr/queue/hdr_segmented_queue_ptb.cpp
deleted file mode 100644 (file)
index 6d8ad49..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-//$$CDS-header$$
-
-#include "hdr_segmented_queue.h"
-#include <cds/container/segmented_queue.h>
-#include <cds/gc/ptb.h>
-
-namespace queue {
-
-    void HdrSegmentedQueue::SegmQueue_PTB()
-    {
-        typedef cds::container::SegmentedQueue< cds::gc::PTB, item > queue_type;
-
-        test<queue_type>();
-    }
-
-    void HdrSegmentedQueue::SegmQueue_PTB_mutex()
-    {
-        typedef cds::container::SegmentedQueue< cds::gc::PTB, item,
-            cds::container::segmented_queue::make_traits<
-                cds::opt::lock_type< std::mutex >
-            >::type
-        > queue_type;
-
-        test<queue_type>();
-    }
-
-    void HdrSegmentedQueue::SegmQueue_PTB_shuffle()
-    {
-        typedef cds::container::SegmentedQueue< cds::gc::PTB, item,
-            cds::container::segmented_queue::make_traits<
-                cds::opt::item_counter< cds::atomicity::item_counter >
-                ,cds::opt::permutation_generator< cds::opt::v::random_shuffle_permutation<> >
-            >::type
-        > queue_type;
-
-        test<queue_type>();
-    }
-
-    void HdrSegmentedQueue::SegmQueue_PTB_stat()
-    {
-        typedef cds::container::SegmentedQueue< cds::gc::PTB, item,
-            cds::container::segmented_queue::make_traits<
-                cds::opt::item_counter< cds::atomicity::item_counter >
-                ,cds::opt::permutation_generator< cds::opt::v::random_permutation<> >
-                ,cds::opt::stat< cds::container::segmented_queue::stat<> >
-            >::type
-        > queue_type;
-
-        test<queue_type>();
-    }
-
-} // namespace queue
index e073626cc87b5b1b02c59fc2aced74cbf3d6ce6a..a51982ff1e5b707032db189007309863797b0109 100644 (file)
@@ -13,7 +13,6 @@
 #include <cds/intrusive/segmented_queue.h>
 
 #include <cds/gc/hp.h>
 #include <cds/intrusive/segmented_queue.h>
 
 #include <cds/gc/hp.h>
-#include <cds/gc/hrc.h> //TODO: remove this line!
 #include <cds/gc/dhp.h>
 
 #include <boost/intrusive/slist.hpp>
 #include <cds/gc/dhp.h>
 
 #include <boost/intrusive/slist.hpp>
index 2c98a4ef618111ff26794477a1e7ae667f723b31..cfd1c66cd1a302af645730904cf47f1e17eb50d4 100644 (file)
@@ -15,7 +15,6 @@
 #include <cds/container/segmented_queue.h>
 
 #include <cds/gc/hp.h>
 #include <cds/container/segmented_queue.h>
 
 #include <cds/gc/hp.h>
-#include <cds/gc/hrc.h> //TODO: remove this line!
 #include <cds/gc/dhp.h>
 
 #include "queue/std_queue.h"
 #include <cds/gc/dhp.h>
 
 #include "queue/std_queue.h"