|
cds
1.4.0
|
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 () |
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.
|
inline |
Initializes ptb::GarbageCollector singleton.
The constructor calls GarbageCollector::Construct with passed parameters. See ptb::GarbageCollector::Construct for explanation of parameters meaning.
|
inline |
|
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.
|
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.
|
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 |
Forced GC cycle call for current thread.
Usually, this function should not be called directly.