cds  1.4.0
Data Structures | Public Types | Public Member Functions | Static Public Member Functions
cds::gc::PTB Class Reference

Pass-the-Buck garbage collector. More...

#include <cds/gc/ptb.h>

Data Structures

struct  container_node
 Base for container node. More...
 
class  Guard
 Pass-the-Buck guard. More...
 
class  GuardArray
 Array of Pass-the-Buck guards. More...
 
class  thread_gc
 Wrapper for ptb::ThreadGC class. More...
 

Public Types

typedef void * guarded_pointer
 Native guarded pointer type.
 
template<typename T >
using atomic_ref = std::atomic< T * >
 Atomic reference.
 
template<typename T >
using atomic_type = std::atomic< T >
 Atomic type.
 
template<typename MarkedPtr >
using atomic_marked_ptr = std::atomic< MarkedPtr >
 Atomic marked pointer.
 
typedef ptb::ThreadGC thread_gc_impl
 Thread GC implementation for internal usage.
 

Public Member Functions

 PTB (size_t nLiberateThreshold=1024, size_t nInitialThreadGuardCount=8)
 Initializes ptb::GarbageCollector singleton. More...
 
 ~PTB ()
 Terminates ptb::GarbageCollector singleton. More...
 

Static Public Member Functions

static bool check_available_guards (size_t nCountNeeded, bool=true)
 Checks if count of hazard pointer is no less than nCountNeeded. More...
 
template<typename T >
static void retire (T *p, void(*pFunc)(T *))
 Retire pointer p with function pFunc. More...
 
template<class Disposer , typename T >
static void retire (T *p)
 Retire pointer p with functor of type Disposer. More...
 
static bool isUsed ()
 Checks if Pass-the-Buck GC is constructed and may be used.
 
static void scan ()
 Forced GC cycle call for current thread. More...
 
static void force_dispose ()
 

Detailed Description

Pass-the-Buck garbage collector.

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

See How to use section for details of garbage collector applying.

Constructor & Destructor Documentation

cds::gc::PTB::PTB ( size_t  nLiberateThreshold = 1024,
size_t  nInitialThreadGuardCount = 8 
)
inline

Initializes ptb::GarbageCollector singleton.

The constructor calls GarbageCollector::Construct with passed parameters. See ptb::GarbageCollector::Construct for explanation of parameters meaning.

cds::gc::PTB::~PTB ( )
inline

Terminates ptb::GarbageCollector singleton.

The destructor calls

Member Function Documentation

static bool cds::gc::PTB::check_available_guards ( size_t  nCountNeeded,
bool  = true 
)
inlinestatic

Checks if count of hazard pointer is no less than nCountNeeded.

The function always returns true since the guard count is unlimited for PTB garbage collector.

template<typename T >
static void cds::gc::PTB::retire ( T *  p,
void(*)(T *)  pFunc 
)
inlinestatic

Retire pointer p with function pFunc.

The function places pointer p to array of pointers ready for removing. (so called retired pointer array). The pointer can be safely removed when no guarded pointer points to it. Deleting the pointer is the function pFunc call.

template<class Disposer , typename T >
static void cds::gc::PTB::retire ( T *  p)
inlinestatic

Retire pointer p with functor of type Disposer.

The function places pointer p to array of pointers ready for removing. (so called retired pointer array). The pointer can be safely removed when no guarded pointer points to it.

See gc::HP::retire for Disposer requirements.

static void cds::gc::PTB::scan ( )
static

Forced GC cycle call for current thread.

Usually, this function should not be called directly.


The documentation for this class was generated from the following file:

cds 1.4.0 Developed by Maxim Khiszinsky aka khizmax 2007 - 2012
Autogenerated Mon May 20 2013 00:37:58 by Doxygen 1.8.3.1