#ifndef __CDS_GC_DHP_DHP_DECL_H
#define __CDS_GC_DHP_DHP_DECL_H
-#include <cds/gc/dhp/dhp.h>
+#include <cds/gc/details/dhp.h>
#include <cds/details/marked_ptr.h>
#include <cds/details/static_functor.h>
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
template <typename MarkedPtr> using atomic_marked_ptr = atomics::atomic<MarkedPtr>;
/// Thread GC implementation for internal usage
- typedef ptb::ThreadGC thread_gc_impl;
+ typedef dhp::ThreadGC thread_gc_impl;
- /// Wrapper for ptb::ThreadGC class
+ /// 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
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 ptb::Guard.
+ This class is a wrapper for dhp::Guard.
*/
- class Guard: public ptb::Guard
+ class Guard: public dhp::Guard
{
//@cond
- typedef ptb::Guard base_class;
+ typedef dhp::Guard base_class;
//@endcond
public:
//@cond
- Guard() ; // inline in ptb_impl.h
+ Guard() ; // inline in dhp_impl.h
//@endcond
/// Protects a pointer of type <tt> atomic<T*> </tt>
};
- /// Array of Pass-the-Buck guards
+ /// Array of Dynamic Hazard Pointer guards
/**
@headerfile cds/gc/dhp.h
- This class is a wrapper for ptb::GuardArray template.
- Template parameter \p Count defines the size of PTB array.
+ This class is a wrapper for dhp::GuardArray template.
+ Template parameter \p Count defines the size of DHP array.
*/
template <size_t Count>
- class GuardArray: public ptb::GuardArray<Count>
+ class GuardArray: public dhp::GuardArray<Count>
{
//@cond
- typedef ptb::GuardArray<Count> base_class;
+ typedef dhp::GuardArray<Count> base_class;
//@endcond
public:
/// Rebind array for other size \p COUNT2
public:
//@cond
- GuardArray() ; // inline in ptb_impl.h
+ GuardArray() ; // inline in dhp_impl.h
//@endcond
/// Protects a pointer of type \p atomic<T*>
};
public:
- /// Initializes ptb::GarbageCollector singleton
+ /// Initializes dhp::GarbageCollector singleton
/**
The constructor calls GarbageCollector::Construct with passed parameters.
- See ptb::GarbageCollector::Construct for explanation of parameters meaning.
+ See dhp::GarbageCollector::Construct for explanation of parameters meaning.
*/
- PTB(
+ DHP(
size_t nLiberateThreshold = 1024
, size_t nInitialThreadGuardCount = 8
)
{
- ptb::GarbageCollector::Construct(
+ dhp::GarbageCollector::Construct(
nLiberateThreshold,
nInitialThreadGuardCount
);
}
- /// Terminates ptb::GarbageCollector singleton
+ /// Terminates dhp::GarbageCollector singleton
/**
- The destructor calls \code ptb::GarbageCollector::Destruct() \endcode
+ The destructor calls \code dhp::GarbageCollector::Destruct() \endcode
*/
- ~PTB()
+ ~DHP()
{
- ptb::GarbageCollector::Destruct();
+ dhp::GarbageCollector::Destruct();
}
/// 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 )
{
template <typename T>
static void retire( T * p, void (* pFunc)(T *) )
{
- ptb::GarbageCollector::instance().retirePtr( p, pFunc );
+ dhp::GarbageCollector::instance().retirePtr( p, pFunc );
}
/// Retire pointer \p p with functor of type \p Disposer
retire( p, cds::details::static_functor<Disposer, T>::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 ptb::GarbageCollector::isUsed();
+ return dhp::GarbageCollector::isUsed();
}
/// Forced GC cycle call for current thread
/**
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()