From 9e67c81b74a9e4b871b486fd4aa90c7de319ed54 Mon Sep 17 00:00:00 2001 From: khizmax Date: Fri, 14 Nov 2014 19:09:38 +0300 Subject: [PATCH] Rename class cds::gc::PTB to cds::gc::DHP --- cds/container/impl/ellen_bintree_map.h | 2 +- cds/container/impl/skip_list_map.h | 2 +- cds/container/impl/skip_list_set.h | 2 +- cds/container/segmented_queue.h | 2 +- cds/container/skip_list_set_dhp.h | 6 +- cds/container/split_list_map.h | 4 +- cds/container/split_list_set.h | 4 +- cds/gc/dhp.h | 6 -- cds/gc/dhp/dhp.h | 75 ++++++++----------- cds/gc/dhp/dhp_decl.h | 48 +++++------- cds/gc/dhp/dhp_impl.h | 16 ++-- cds/gc/hp/hp.h | 2 +- cds/intrusive/impl/ellen_bintree.h | 2 +- cds/intrusive/segmented_queue.h | 2 +- cds/threading/details/_common.h | 32 ++++---- cds/threading/details/cxx11_manager.h | 12 +-- cds/threading/details/gcc_manager.h | 12 +-- cds/threading/details/msvc_manager.h | 12 +-- cds/threading/details/pthread_manager.h | 10 +-- cds/threading/details/wintls_manager.h | 10 +-- cds/threading/model.h | 10 +-- src/dhp_gc.cpp | 2 +- tests/cppunit/test_main.cpp | 2 +- .../hdr_intrusive_ellen_bintree_pool_dhp.h | 2 +- 24 files changed, 127 insertions(+), 150 deletions(-) diff --git a/cds/container/impl/ellen_bintree_map.h b/cds/container/impl/ellen_bintree_map.h index 3ca0dbf2..3187f55b 100644 --- a/cds/container/impl/ellen_bintree_map.h +++ b/cds/container/impl/ellen_bintree_map.h @@ -50,7 +50,7 @@ namespace cds { namespace container { @note Do not include header file directly. There are header file for each GC type: - - for Hazard Pointer GC cds::gc::HP - - - for Pass-the-Buck GC cds::gc::DHP + - - for Dynamic Hazard Pointer GC cds::gc::DHP - - for RCU GC (see \ref cds_container_EllenBinTreeMap_rcu "RCU-based EllenBinTreeMap") */ diff --git a/cds/container/impl/skip_list_map.h b/cds/container/impl/skip_list_map.h index e2c17d03..98f73d66 100644 --- a/cds/container/impl/skip_list_map.h +++ b/cds/container/impl/skip_list_map.h @@ -67,7 +67,7 @@ namespace cds { namespace container { before end of the map. Therefore, such iteration is more suitable for debugging purpose only Remember, each iterator object requires 2 additional hazard pointers, that may be - a limited resource for \p GC like \p gc::HP (for gc::PTB the count of + a limited resource for \p GC like \p gc::HP (for gc::DHP the count of guards is unlimited). The iterator class supports the following minimalistic interface: diff --git a/cds/container/impl/skip_list_set.h b/cds/container/impl/skip_list_set.h index a281df79..9de1eb5e 100644 --- a/cds/container/impl/skip_list_set.h +++ b/cds/container/impl/skip_list_set.h @@ -65,7 +65,7 @@ namespace cds { namespace container { before end of the set. Therefore, such iteration is more suitable for debugging purpose only Remember, each iterator object requires 2 additional hazard pointers, that may be - a limited resource for \p GC like \p gc::HP (for \p gc::PTB the count of + a limited resource for \p GC like \p gc::HP (for \p gc::DHP the count of guards is unlimited). The iterator class supports the following minimalistic interface: diff --git a/cds/container/segmented_queue.h b/cds/container/segmented_queue.h index ea4cd957..69361eec 100644 --- a/cds/container/segmented_queue.h +++ b/cds/container/segmented_queue.h @@ -167,7 +167,7 @@ namespace cds { namespace container { quasi factor. It means that the consumer dequeues any item from the current first segment. Template parameters: - - \p GC - a garbage collector, possible types are cds::gc::HP, cds::gc::PTB + - \p GC - a garbage collector, possible types are cds::gc::HP, cds::gc::DHP - \p T - the type of values stored in the queue - \p Traits - queue type traits, default is \p segmented_queue::traits. \p segmented_queue::make_traits metafunction can be used to construct your diff --git a/cds/container/skip_list_set_dhp.h b/cds/container/skip_list_set_dhp.h index 3e0d26e9..4b86615d 100644 --- a/cds/container/skip_list_set_dhp.h +++ b/cds/container/skip_list_set_dhp.h @@ -1,11 +1,11 @@ //$$CDS-header$$ -#ifndef __CDS_CONTAINER_SKIP_LIST_MAP_PTB_H -#define __CDS_CONTAINER_SKIP_LIST_MAP_PTB_H +#ifndef __CDS_CONTAINER_SKIP_LIST_MAP_DHP_H +#define __CDS_CONTAINER_SKIP_LIST_MAP_DHP_H #include #include #include #include -#endif // #ifndef __CDS_CONTAINER_SKIP_LIST_MAP_PTB_H +#endif // #ifndef __CDS_CONTAINER_SKIP_LIST_MAP_DHP_H diff --git a/cds/container/split_list_map.h b/cds/container/split_list_map.h index 05ecd615..c3c8b055 100644 --- a/cds/container/split_list_map.h +++ b/cds/container/split_list_map.h @@ -70,13 +70,13 @@ namespace cds { namespace container { Now you are ready to declare our map class based on \p %SplitListMap: \code - typedef cc::SplitListMap< cds::gc::PTB, int, std::string, foo_set_traits > int_string_map; + typedef cc::SplitListMap< cds::gc::DHP, int, std::string, foo_set_traits > int_string_map; \endcode You may use the modern option-based declaration instead of classic type-traits-based one: \code typedef cc:SplitListMap< - cs::gc::PTB // GC used + cs::gc::DHP // GC used ,int // key type ,std::string // value type ,cc::split_list::make_traits< // metafunction to build split-list traits diff --git a/cds/container/split_list_set.h b/cds/container/split_list_set.h index 24a2cbb8..b4a6a39e 100644 --- a/cds/container/split_list_set.h +++ b/cds/container/split_list_set.h @@ -90,13 +90,13 @@ namespace cds { namespace container { Now you are ready to declare our set class based on \p %SplitListSet: \code - typedef cc::SplitListSet< cds::gc::PTB, foo, foo_set_traits > foo_set; + typedef cc::SplitListSet< cds::gc::DHP, foo, foo_set_traits > foo_set; \endcode You may use the modern option-based declaration instead of classic traits-based one: \code typedef cc:SplitListSet< - cs::gc::PTB // GC used + cs::gc::DHP // GC used ,foo // type of data stored ,cc::split_list::make_traits< // metafunction to build split-list traits cc::split_list::ordered_list // tag for underlying ordered list implementation diff --git a/cds/gc/dhp.h b/cds/gc/dhp.h index c854b91a..6209e815 100644 --- a/cds/gc/dhp.h +++ b/cds/gc/dhp.h @@ -7,10 +7,4 @@ #include #include -//@cond -namespace cds { namespace gc { - typedef PTB DHP; -}} // namespace cds::gc -//@endcond - #endif // #ifndef __CDS_GC_DHP_H diff --git a/cds/gc/dhp/dhp.h b/cds/gc/dhp/dhp.h index f90d5f20..7cf050dc 100644 --- a/cds/gc/dhp/dhp.h +++ b/cds/gc/dhp/dhp.h @@ -17,30 +17,21 @@ namespace cds { namespace gc { - /// Pass The Buck reclamation schema + /// Dynamic Hazard Pointer reclamation schema /** - \par Sources: - - [2002] M. Herlihy, V. Luchangco, and M. Moir. The repeat offender problem: A mechanism for supporting - dynamic-sized lockfree data structures. Technical Report TR-2002-112, Sun Microsystems Laboratories, 2002 - - [2002] M. Herlihy, V. Luchangco, P. Martin, and M. Moir. Dynamic-sized Lockfree Data Structures. - Technical Report TR-2002-110, Sun Microsystems Laboratories, 2002 - - [2005] M. Herlihy, V. Luchangco, P. Martin, and M. Moir. Nonblocking Memory Management Support - for Dynamic-Sized Data Structures. ACM Transactions on Computer Systems, Vol.23, No.2, May 2005 + The cds::gc::dhp namespace and its members are internal representation of the GC and should not be used directly. + Use cds::gc::DHP class in your code. - - The cds::gc::dhp namespace and its members are internal representation of the Pass-the-Buck GC and should not be used directly. - Use cds::gc::PTB class in your code. - - Pass-the-Buck (PTB) garbage collector is a singleton. The main user-level part of PTB schema is - GC class and its nested classes. Before use any PTB-related class you must initialize PTB garbage collector - by contructing cds::gc::PTB object in beginning of your main(). - See cds::gc::PTB class for explanation. + Dynamic Hazard Pointer (DHP) garbage collector is a singleton. The main user-level part of DHP schema is + GC class and its nested classes. Before use any DHP-related class you must initialize DHP garbage collector + by contructing cds::gc::DHP object in beginning of your main(). + See cds::gc::DHP class for explanation. \par Implementation issues - The global list of free guards (cds::gc::dhp::details::guard_allocator) is protected by spin-lock (i.e. serialized). - It seems that solution should not introduce significant performance bottleneck, because each thread has own set - of guards allocated from global list of free guards and access to global list is occurred only when - all thread's guard is busy. In this case the thread allocates next block of guards from global list. + The global list of free guards (\p cds::gc::dhp::details::guard_allocator) is protected by a spin-lock (i.e. serialized). + It seems that this solution should not introduce significant performance bottleneck, because each thread has its own set + of guards allocated from the global list of free guards and the access to the global list is occurred only when + all thread's guard is busy. In this case the thread allocates a next block of guards from the global list. Guards allocated for the thread is push back to the global list only when the thread terminates. */ namespace dhp { @@ -56,7 +47,7 @@ namespace cds { namespace gc { using cds::gc::details::free_retired_ptr_func; - /// Details of Pass the Buck algorithm + /// Details of Dynamic Hazard Pointer algorithm namespace details { // Forward declaration @@ -292,14 +283,14 @@ namespace cds { namespace gc { return m_nItemCount.fetch_add( 1, atomics::memory_order_relaxed ) + 1; } - /// Result of \ref ptb_gc_privatve "privatize" function. + /// Result of \ref dhp_gc_privatve "privatize" function. /** The \p privatize function returns retired node list as \p first and the size of that list as \p second. */ typedef std::pair privatize_result; /// Gets current list of retired pointer and clears the list - /**@anchor ptb_gc_privatve + /**@anchor dhp_gc_privatve */ privatize_result privatize() { @@ -585,7 +576,7 @@ namespace cds { namespace gc { /// Returns guard allocated back to pool of free guards ~Guard(); // inline after GarbageCollector - /// Returns PTB GC object + /// Returns DHP GC object ThreadGC& getGC() { return m_gc; @@ -644,7 +635,7 @@ namespace cds { namespace gc { return c_nCapacity; } - /// Returns PTB ThreadGC object + /// Returns DHP ThreadGC object ThreadGC& getGC() CDS_NOEXCEPT { return m_gc; @@ -709,7 +700,7 @@ namespace cds { namespace gc { public: /// Exception "No GarbageCollector object is created" - CDS_DECLARE_EXCEPTION( PTBManagerEmpty, "Global PTB GarbageCollector is NULL" ); + CDS_DECLARE_EXCEPTION( DHPManagerEmpty, "Global DHP GarbageCollector is NULL" ); /// Internal GC statistics struct InternalState @@ -748,17 +739,17 @@ namespace cds { namespace gc { bool m_bStatEnabled ; ///< Internal Statistics enabled public: - /// Initializes PTB memory manager singleton + /// Initializes DHP memory manager singleton /** - This member function creates and initializes PTB global object. - The function should be called before using CDS data structure based on cds::gc::PTB GC. Usually, + This member function creates and initializes DHP global object. + The function should be called before using CDS data structure based on cds::gc::DHP GC. Usually, this member function is called in the \p main() function. See cds::gc::dhp for example. - After calling of this function you may use CDS data structures based on cds::gc::PTB. + After calling of this function you may use CDS data structures based on cds::gc::DHP. \par Parameters \li \p nLiberateThreshold - the liberate threshold. When count of retired pointers reaches this value, - the \ref ptb_gc_liberate "liberate" member function would be called for freeing retired pointers. - If \p nLiberateThreshold <= 1, \p liberate would called after each \ref ptb_gc_retirePtr "retirePtr" call. + the \ref dhp_gc_liberate "liberate" member function would be called for freeing retired pointers. + If \p nLiberateThreshold <= 1, \p liberate would called after each \ref dhp_gc_retirePtr "retirePtr" call. \li \p nInitialThreadGuardCount - initial count of guard allocated for ThreadGC. When a thread is initialized the GC allocates local guard pool for the thread from common guard pool. By perforce the local thread's guard pool is grown automatically from common pool. @@ -770,22 +761,22 @@ namespace cds { namespace gc { , size_t nInitialThreadGuardCount = 8 ); - /// Destroys PTB memory manager + /// Destroys DHP memory manager /** - The member function destroys PTB global object. After calling of this function you may \b NOT - use CDS data structures based on cds::gc::PTB. Usually, the \p Destruct function is called + The member function destroys DHP global object. After calling of this function you may \b NOT + use CDS data structures based on cds::gc::DHP. Usually, the \p Destruct function is called at the end of your \p main(). See cds::gc::dhp for example. */ static void CDS_STDCALL Destruct(); /// Returns pointer to GarbageCollector instance /** - If PTB GC is not initialized, \p PTBManagerEmpty exception is thrown + If DHP GC is not initialized, \p DHPManagerEmpty exception is thrown */ static GarbageCollector& instance() { if ( m_pManager == nullptr ) - throw PTBManagerEmpty(); + throw DHPManagerEmpty(); return *m_pManager; } @@ -824,7 +815,7 @@ namespace cds { namespace gc { } /// Places retired pointer \p and its deleter \p pFunc into thread's array of retired pointer for deferred reclamation - /**@anchor ptb_gc_retirePtr + /**@anchor dhp_gc_retirePtr */ template void retirePtr( T * p, void (* pFunc)(T *) ) @@ -841,8 +832,8 @@ namespace cds { namespace gc { protected: /// Liberate function - /** @anchor ptb_gc_liberate - The main function of Pass The Buck algorithm. It tries to free retired pointers if they are not + /** @anchor dhp_gc_liberate + The main function of Dynamic Hazard Pointer algorithm. It tries to free retired pointers if they are not trapped by any guard. */ void liberate(); @@ -886,9 +877,9 @@ namespace cds { namespace gc { /// Thread GC /** - To use Pass The Buck reclamation schema each thread object must be linked with the object of ThreadGC class + To use Dynamic Hazard Pointer reclamation schema each thread object must be linked with the object of ThreadGC class that interacts with GarbageCollector global object. The linkage is performed by calling \ref cds_threading "cds::threading::Manager::attachThread()" - on the start of each thread that uses PTB GC. Before terminating the thread linked to PTB GC it is necessary to call + on the start of each thread that uses DHP GC. Before terminating the thread linked to DHP GC it is necessary to call \ref cds_threading "cds::threading::Manager::detachThread()". The ThreadGC object maintains two list: diff --git a/cds/gc/dhp/dhp_decl.h b/cds/gc/dhp/dhp_decl.h index 7f55d981..651d3127 100644 --- a/cds/gc/dhp/dhp_decl.h +++ b/cds/gc/dhp/dhp_decl.h @@ -9,22 +9,14 @@ namespace cds { namespace gc { - /// Pass-the-Buck garbage collector + /// Dynamic Hazard Pointer garbage collector /** @ingroup cds_garbage_collector @headerfile cds/gc/dhp.h - This class is a wrapper for Pass-the-Buck garbage collector internal implementation. - - Sources: - - [2002] M. Herlihy, V. Luchangco, and M. Moir. The repeat offender problem: A mechanism for supporting - dynamic-sized lockfree data structures. Technical Report TR-2002-112, Sun Microsystems Laboratories, 2002 - - [2002] M. Herlihy, V. Luchangco, P. Martin, and M. Moir. Dynamic-sized Lockfree Data Structures. - Technical Report TR-2002-110, Sun Microsystems Laboratories, 2002 - - [2005] M. Herlihy, V. Luchangco, P. Martin, and M. Moir. Nonblocking Memory Management Support - for Dynamic_Sized Data Structures. ACM Transactions on Computer Systems, Vol.23, No.2, May 2005 + This class is a wrapper for Dynamic Hazard Pointer garbage collector internal implementation. See \ref cds_how_to_use "How to use" section for details of garbage collector applying. */ - class PTB + class DHP { public: /// Native guarded pointer type @@ -54,7 +46,7 @@ namespace cds { namespace gc { /// Wrapper for dhp::ThreadGC class /** @headerfile cds/gc/dhp.h - This class performs automatically attaching/detaching Pass-the-Buck GC + This class performs automatically attaching/detaching Dynamic Hazard Pointer GC for the current thread. */ class thread_gc: public thread_gc_impl @@ -65,26 +57,26 @@ namespace cds { namespace gc { public: /// Constructor /** - The constructor attaches the current thread to the Pass-the-Buck GC + The constructor attaches the current thread to the Dynamic Hazard Pointer GC if it is not yet attached. The \p bPersistent parameter specifies attachment persistence: - - \p true - the class destructor will not detach the thread from Pass-the-Buck GC. - - \p false (default) - the class destructor will detach the thread from Pass-the-Buck GC. + - \p true - the class destructor will not detach the thread from Dynamic Hazard Pointer GC. + - \p false (default) - the class destructor will detach the thread from Dynamic Hazard Pointer GC. */ thread_gc( bool bPersistent = false - ) ; // inline in ptb_impl.h + ) ; // inline in dhp_impl.h /// Destructor /** If the object has been created in persistent mode, the destructor does nothing. - Otherwise it detaches the current thread from Pass-the-Buck GC. + Otherwise it detaches the current thread from Dynamic Hazard Pointer GC. */ - ~thread_gc() ; // inline in ptb_impl.h + ~thread_gc() ; // inline in dhp_impl.h }; - /// Pass-the-Buck guard + /// Dynamic Hazard Pointer guard /** @headerfile cds/gc/dhp.h This class is a wrapper for dhp::Guard. @@ -97,7 +89,7 @@ namespace cds { namespace gc { public: //@cond - Guard() ; // inline in ptb_impl.h + Guard() ; // inline in dhp_impl.h //@endcond /// Protects a pointer of type atomic @@ -205,11 +197,11 @@ namespace cds { namespace gc { }; - /// Array of Pass-the-Buck guards + /// Array of Dynamic Hazard Pointer guards /** @headerfile cds/gc/dhp.h This class is a wrapper for dhp::GuardArray template. - Template parameter \p Count defines the size of PTB array. + Template parameter \p Count defines the size of DHP array. */ template class GuardArray: public dhp::GuardArray @@ -226,7 +218,7 @@ namespace cds { namespace gc { public: //@cond - GuardArray() ; // inline in ptb_impl.h + GuardArray() ; // inline in dhp_impl.h //@endcond /// Protects a pointer of type \p atomic @@ -341,7 +333,7 @@ namespace cds { namespace gc { The constructor calls GarbageCollector::Construct with passed parameters. See dhp::GarbageCollector::Construct for explanation of parameters meaning. */ - PTB( + DHP( size_t nLiberateThreshold = 1024 , size_t nInitialThreadGuardCount = 8 ) @@ -356,7 +348,7 @@ namespace cds { namespace gc { /** The destructor calls \code dhp::GarbageCollector::Destruct() \endcode */ - ~PTB() + ~DHP() { dhp::GarbageCollector::Destruct(); } @@ -364,7 +356,7 @@ namespace cds { namespace gc { /// Checks if count of hazard pointer is no less than \p nCountNeeded /** The function always returns \p true since the guard count is unlimited for - PTB garbage collector. + DHP garbage collector. */ static bool check_available_guards( size_t nCountNeeded, bool /*bRaiseException*/ = true ) { @@ -397,7 +389,7 @@ namespace cds { namespace gc { retire( p, cds::details::static_functor::call ); } - /// Checks if Pass-the-Buck GC is constructed and may be used + /// Checks if Dynamic Hazard Pointer GC is constructed and may be used static bool isUsed() { return dhp::GarbageCollector::isUsed(); @@ -407,7 +399,7 @@ namespace cds { namespace gc { /** Usually, this function should not be called directly. */ - static void scan() ; // inline in ptb_impl.h + static void scan() ; // inline in dhp_impl.h /// Synonym for \ref scan() static void force_dispose() diff --git a/cds/gc/dhp/dhp_impl.h b/cds/gc/dhp/dhp_impl.h index 2d88afad..a21db87a 100644 --- a/cds/gc/dhp/dhp_impl.h +++ b/cds/gc/dhp/dhp_impl.h @@ -8,7 +8,7 @@ //@cond namespace cds { namespace gc { - inline PTB::thread_gc::thread_gc( + inline DHP::thread_gc::thread_gc( bool bPersistent ) : m_bPersistent( bPersistent ) @@ -17,24 +17,24 @@ namespace cds { namespace gc { cds::threading::Manager::attachThread(); } - inline PTB::thread_gc::~thread_gc() + inline DHP::thread_gc::~thread_gc() { if ( !m_bPersistent ) cds::threading::Manager::detachThread(); } - inline PTB::Guard::Guard() - : Guard::base_class( cds::threading::getGC() ) + inline DHP::Guard::Guard() + : Guard::base_class( cds::threading::getGC() ) {} template - inline PTB::GuardArray::GuardArray() - : GuardArray::base_class( cds::threading::getGC() ) + inline DHP::GuardArray::GuardArray() + : GuardArray::base_class( cds::threading::getGC() ) {} - inline void PTB::scan() + inline void DHP::scan() { - cds::threading::getGC().scan(); + cds::threading::getGC().scan(); } }} // namespace cds::gc diff --git a/cds/gc/hp/hp.h b/cds/gc/hp/hp.h index 30df8116..c2af861b 100644 --- a/cds/gc/hp/hp.h +++ b/cds/gc/hp/hp.h @@ -36,7 +36,7 @@ namespace cds { Feature %cds::gc::HP - %cds::gc::PTB + %cds::gc::DHP Implementation quality diff --git a/cds/intrusive/impl/ellen_bintree.h b/cds/intrusive/impl/ellen_bintree.h index ca9fa2d3..e6f2e993 100644 --- a/cds/intrusive/impl/ellen_bintree.h +++ b/cds/intrusive/impl/ellen_bintree.h @@ -44,7 +44,7 @@ namespace cds { namespace intrusive { @note Do not include header file explicitly. There are header file for each GC type: - - for Hazard Pointer GC \p cds::gc::HP - - - for Pass-the-Buck GC \p cds::gc::DHP + - - for Dynamic Hazard Pointer GC \p cds::gc::DHP - - for RCU (see \ref cds_intrusive_EllenBinTree_rcu "RCU-based EllenBinTree") Template arguments : diff --git a/cds/intrusive/segmented_queue.h b/cds/intrusive/segmented_queue.h index 3b715127..d10ab14b 100644 --- a/cds/intrusive/segmented_queue.h +++ b/cds/intrusive/segmented_queue.h @@ -187,7 +187,7 @@ namespace cds { namespace intrusive { quasi factor. This means that the consumer dequeues any item from the current first segment. Template parameters: - - \p GC - a garbage collector, possible types are cds::gc::HP, cds::gc::PTB + - \p GC - a garbage collector, possible types are cds::gc::HP, cds::gc::DHP - \p T - the type of values stored in the queue - \p Traits - queue type traits, default is \p segmented_queue::traits. \p segmented_queue::make_traits metafunction can be used to construct the diff --git a/cds/threading/details/_common.h b/cds/threading/details/_common.h index 86f63c54..1079303f 100644 --- a/cds/threading/details/_common.h +++ b/cds/threading/details/_common.h @@ -74,8 +74,8 @@ namespace cds { // Get cds::gc::HP thread GC implementation for current thread static gc::HP::thread_gc_impl& getHZPGC(); - // Get cds::gc::PTB thread GC implementation for current thread; - static gc::PTB::thread_gc_impl& getPTBGC(); + // Get cds::gc::DHP thread GC implementation for current thread; + static gc::DHP::thread_gc_impl& getDHPGC(); }; \endcode @@ -109,8 +109,8 @@ namespace cds { struct ThreadData { //@cond - char CDS_DATA_ALIGNMENT(8) m_hpManagerPlaceholder[sizeof(cds::gc::HP::thread_gc_impl)] ; ///< Michael's Hazard Pointer GC placeholder - char CDS_DATA_ALIGNMENT(8) m_ptbManagerPlaceholder[sizeof(cds::gc::PTB::thread_gc_impl)] ; ///< Pass The Buck GC placeholder + char CDS_DATA_ALIGNMENT(8) m_hpManagerPlaceholder[sizeof(cds::gc::HP::thread_gc_impl)]; ///< Michael's Hazard Pointer GC placeholder + char CDS_DATA_ALIGNMENT(8) m_dhpManagerPlaceholder[sizeof(cds::gc::DHP::thread_gc_impl)]; ///< Dynamic Hazard Pointer GC placeholder cds::urcu::details::thread_data< cds::urcu::general_instant_tag > * m_pGPIRCU; cds::urcu::details::thread_data< cds::urcu::general_buffered_tag > * m_pGPBRCU; @@ -123,7 +123,7 @@ namespace cds { //@endcond cds::gc::HP::thread_gc_impl * m_hpManager ; ///< Michael's Hazard Pointer GC thread-specific data - cds::gc::PTB::thread_gc_impl * m_ptbManager ; ///< Pass The Buck GC thread-specific data + cds::gc::DHP::thread_gc_impl * m_dhpManager ; ///< Dynamic Hazard Pointer GC thread-specific data size_t m_nFakeProcessorNumber ; ///< fake "current processor" number @@ -156,10 +156,10 @@ namespace cds { else m_hpManager = nullptr; - if ( cds::gc::PTB::isUsed() ) - m_ptbManager = new (m_ptbManagerPlaceholder) cds::gc::PTB::thread_gc_impl; + if ( cds::gc::DHP::isUsed() ) + m_dhpManager = new (m_dhpManagerPlaceholder) cds::gc::DHP::thread_gc_impl; else - m_ptbManager = nullptr; + m_dhpManager = nullptr; } ~ThreadData() @@ -170,10 +170,10 @@ namespace cds { m_hpManager = nullptr; } - if ( m_ptbManager ) { - typedef cds::gc::PTB::thread_gc_impl ptb_thread_gc_impl; - m_ptbManager->~ptb_thread_gc_impl(); - m_ptbManager = nullptr; + if ( m_dhpManager ) { + typedef cds::gc::DHP::thread_gc_impl dhp_thread_gc_impl; + m_dhpManager->~dhp_thread_gc_impl(); + m_dhpManager = nullptr; } assert( m_pGPIRCU == nullptr ); @@ -190,8 +190,8 @@ namespace cds { if ( m_nAttachCount++ == 0 ) { if ( cds::gc::HP::isUsed() ) m_hpManager->init(); - if ( cds::gc::PTB::isUsed() ) - m_ptbManager->init(); + if ( cds::gc::DHP::isUsed() ) + m_dhpManager->init(); if ( cds::urcu::details::singleton::isUsed() ) m_pGPIRCU = cds::urcu::details::singleton::attach_thread(); @@ -211,8 +211,8 @@ namespace cds { bool fini() { if ( --m_nAttachCount == 0 ) { - if ( cds::gc::PTB::isUsed() ) - m_ptbManager->fini(); + if ( cds::gc::DHP::isUsed() ) + m_dhpManager->fini(); if ( cds::gc::HP::isUsed() ) m_hpManager->fini(); diff --git a/cds/threading/details/cxx11_manager.h b/cds/threading/details/cxx11_manager.h index 625380a6..e2b56b07 100644 --- a/cds/threading/details/cxx11_manager.h +++ b/cds/threading/details/cxx11_manager.h @@ -107,16 +107,16 @@ namespace cds { namespace threading { return *(_threadData()->m_hpManager); } - /// Get gc::PTB thread GC implementation for current thread + /// Get gc::DHP thread GC implementation for current thread /** The object returned may be uninitialized if you did not call attachThread in the beginning of thread execution - or if you did not use gc::PTB. - To initialize gc::PTB GC you must constuct cds::gc::PTB object in the beginning of your application + or if you did not use gc::DHP. + To initialize gc::DHP GC you must constuct cds::gc::DHP object in the beginning of your application */ - static gc::PTB::thread_gc_impl& getPTBGC() + static gc::DHP::thread_gc_impl& getDHPGC() { - assert( _threadData()->m_ptbManager != nullptr ); - return *(_threadData()->m_ptbManager); + assert( _threadData()->m_dhpManager != nullptr ); + return *(_threadData()->m_dhpManager); } //@cond diff --git a/cds/threading/details/gcc_manager.h b/cds/threading/details/gcc_manager.h index 0c0c7e2a..a317e78c 100644 --- a/cds/threading/details/gcc_manager.h +++ b/cds/threading/details/gcc_manager.h @@ -107,16 +107,16 @@ namespace cds { namespace threading { return *(_threadData()->m_hpManager); } - /// Get gc::PTB thread GC implementation for current thread + /// Get gc::DHP thread GC implementation for current thread /** The object returned may be uninitialized if you did not call attachThread in the beginning of thread execution - or if you did not use gc::PTB. - To initialize gc::PTB GC you must constuct cds::gc::PTB object in the beginning of your application + or if you did not use gc::DHP. + To initialize gc::DHP GC you must constuct cds::gc::DHP object in the beginning of your application */ - static gc::PTB::thread_gc_impl& getPTBGC() + static gc::DHP::thread_gc_impl& getDHPGC() { - assert( _threadData()->m_ptbManager ); - return *(_threadData()->m_ptbManager); + assert( _threadData()->m_dhpManager ); + return *(_threadData()->m_dhpManager); } //@cond diff --git a/cds/threading/details/msvc_manager.h b/cds/threading/details/msvc_manager.h index c6660a01..ab062d95 100644 --- a/cds/threading/details/msvc_manager.h +++ b/cds/threading/details/msvc_manager.h @@ -107,16 +107,16 @@ namespace cds { namespace threading { return *(_threadData()->m_hpManager); } - /// Get gc::PTB thread GC implementation for current thread + /// Get gc::DHP thread GC implementation for current thread /** The object returned may be uninitialized if you did not call attachThread in the beginning of thread execution - or if you did not use gc::PTB. - To initialize gc::PTB GC you must constuct cds::gc::PTB object in the beginning of your application + or if you did not use gc::DHP. + To initialize gc::DHP GC you must constuct cds::gc::DHP object in the beginning of your application */ - static gc::PTB::thread_gc_impl& getPTBGC() + static gc::DHP::thread_gc_impl& getDHPGC() { - assert( _threadData()->m_ptbManager ); - return *(_threadData()->m_ptbManager); + assert( _threadData()->m_dhpManager ); + return *(_threadData()->m_dhpManager); } //@cond diff --git a/cds/threading/details/pthread_manager.h b/cds/threading/details/pthread_manager.h index 99fadd5a..ab7b6a8f 100644 --- a/cds/threading/details/pthread_manager.h +++ b/cds/threading/details/pthread_manager.h @@ -204,15 +204,15 @@ namespace cds { namespace threading { return *(_threadData( do_getData )->m_hpManager); } - /// Get gc::PTB thread GC implementation for current thread + /// Get gc::DHP thread GC implementation for current thread /** The object returned may be uninitialized if you did not call attachThread in the beginning of thread execution - or if you did not use gc::PTB. - To initialize gc::PTB GC you must constuct cds::gc::PTB object in the beginning of your application + or if you did not use gc::DHP. + To initialize gc::DHP GC you must constuct cds::gc::DHP object in the beginning of your application */ - static gc::PTB::thread_gc_impl& getPTBGC() + static gc::DHP::thread_gc_impl& getDHPGC() { - return *(_threadData( do_getData )->m_ptbManager); + return *(_threadData( do_getData )->m_dhpManager); } //@cond diff --git a/cds/threading/details/wintls_manager.h b/cds/threading/details/wintls_manager.h index 47b2de3c..5ffdc981 100644 --- a/cds/threading/details/wintls_manager.h +++ b/cds/threading/details/wintls_manager.h @@ -207,15 +207,15 @@ namespace cds { namespace threading { return *(_threadData( do_getData )->m_hpManager); } - /// Get gc::PTB thread GC implementation for current thread + /// Get gc::DHP thread GC implementation for current thread /** The object returned may be uninitialized if you did not call attachThread in the beginning of thread execution - or if you did not use gc::PTB. - To initialize gc::PTB GC you must constuct cds::gc::PTB object in the beginning of your application + or if you did not use gc::DHP. + To initialize gc::DHP GC you must constuct cds::gc::DHP object in the beginning of your application */ - static gc::PTB::thread_gc_impl& getPTBGC() + static gc::DHP::thread_gc_impl& getDHPGC() { - return *(_threadData( do_getData )->m_ptbManager); + return *(_threadData( do_getData )->m_dhpManager); } //@cond diff --git a/cds/threading/model.h b/cds/threading/model.h index 3a7bd340..4ae5ce7e 100644 --- a/cds/threading/model.h +++ b/cds/threading/model.h @@ -31,17 +31,17 @@ namespace cds { namespace threading { return Manager::getHZPGC(); } - /// Get cds::gc::PTB thread GC implementation for current thread + /// Get cds::gc::DHP thread GC implementation for current thread /** The object returned may be uninitialized if you did not call attachThread in the beginning of thread execution - or if you did not use cds::gc::PTB. - To initialize cds::gc::PTB GC you must constuct cds::gc::PTB object in the beginning of your application, + or if you did not use cds::gc::DHP. + To initialize cds::gc::DHP GC you must constuct cds::gc::DHP object in the beginning of your application, see \ref cds_how_to_use "How to use libcds" */ template <> - inline cds::gc::PTB::thread_gc_impl& getGC() + inline cds::gc::DHP::thread_gc_impl& getGC() { - return Manager::getPTBGC(); + return Manager::getDHPGC(); } //@cond diff --git a/src/dhp_gc.cpp b/src/dhp_gc.cpp index 1a2902a2..9b72a73c 100644 --- a/src/dhp_gc.cpp +++ b/src/dhp_gc.cpp @@ -1,6 +1,6 @@ //$$CDS-header$$ -// Pass The Buck (PTB) Memory manager implementation +// Dynamic Hazard Pointer memory manager implementation #include // std::fill #include // std::hash diff --git a/tests/cppunit/test_main.cpp b/tests/cppunit/test_main.cpp index 485f95c1..d9dfcc1b 100644 --- a/tests/cppunit/test_main.cpp +++ b/tests/cppunit/test_main.cpp @@ -331,7 +331,7 @@ int main(int argc, char** argv) // Safe reclamation schemes cds::gc::HP hzpGC( nHazardPtrCount ); - cds::gc::PTB ptbGC; + cds::gc::DHP dhpGC; // RCU varieties typedef cds::urcu::gc< cds::urcu::general_instant<> > rcu_gpi; diff --git a/tests/test-hdr/tree/hdr_intrusive_ellen_bintree_pool_dhp.h b/tests/test-hdr/tree/hdr_intrusive_ellen_bintree_pool_dhp.h index 8c67b652..9cbef057 100644 --- a/tests/test-hdr/tree/hdr_intrusive_ellen_bintree_pool_dhp.h +++ b/tests/test-hdr/tree/hdr_intrusive_ellen_bintree_pool_dhp.h @@ -12,7 +12,7 @@ namespace tree { namespace ellen_bintree_dhp { - typedef cds::intrusive::ellen_bintree::node_types node_types; + typedef cds::intrusive::ellen_bintree::node_types node_types; typedef node_types::leaf_node_type leaf_node; typedef IntrusiveBinTreeHdrTest::base_hook_value< leaf_node > base_value; typedef node_types::internal_node_type internal_node; -- 2.34.1