|
cds
2.3.3
|
User-space general-purpose RCU with special thread for deferred reclamation. More...
#include <cds/urcu/general_threaded.h>
Public Types | |
| typedef general_threaded< Buffer, Lock, DisposerThread, Backoff > | rcu_implementation |
| Wrapped URCU implementation. | |
| typedef rcu_implementation::rcu_tag | rcu_tag |
| URCU tag. | |
| typedef rcu_implementation::thread_gc | thread_gc |
| Thread-side RCU part. | |
| typedef rcu_implementation::scoped_lock | scoped_lock |
| Access lock class. | |
Public Member Functions | |
| gc (size_t nBufferCapacity=256) | |
Creates URCU general_threaded singleton. | |
| ~gc () | |
Destroys URCU general_threaded singleton. | |
Static Public Member Functions | |
| static void | synchronize () |
| Waits to finish a grace period and calls disposing thread. More... | |
| template<typename T > | |
| static void | retire_ptr (T *p, free_retired_ptr_func pFunc) |
Retires pointer p by the disposer pFunc. More... | |
| template<typename Disposer , typename T > | |
| static void | retire_ptr (T *p) |
Retires pointer p using Disposer. More... | |
| static void | retire_ptr (retired_ptr &p) |
Retires pointer p of type retired_ptr. More... | |
| template<typename ForwardIterator > | |
| static void | batch_retire (ForwardIterator itFirst, ForwardIterator itLast) |
Frees chain [ itFirst, itLast) in one synchronization cycle. | |
| template<typename Func > | |
| static void | batch_retire (Func e) |
Retires the pointer chain until Func returns nullptr retired pointer. | |
| static void | access_lock () |
| Acquires access lock (so called RCU reader-side lock) More... | |
| static void | access_unlock () |
| Releases access lock (so called RCU reader-side lock) More... | |
| static bool | is_locked () |
| Checks if the thread is inside read-side critical section (i.e. the lock is acquired) More... | |
| static size_t | capacity () |
| Returns the threshold of internal buffer. | |
| static void | force_dispose () |
| Forces retired object removal (synchronous version of synchronize) More... | |
User-space general-purpose RCU with special thread for deferred reclamation.
This is a wrapper around general_threaded class.
Template arguments:
Buffer - lock-free MPSC (muliple producer/single consumer) queue. Default is cds::container::VyukovMPSCCycleQueue< retired_ptr > Lock - mutex type, default is std::mutex DisposerThread - reclamation thread class, default is cds::urcu::dispose_thread See cds::urcu::dispose_thread for class interface.Backoff - back-off schema, default is cds::backoff::Default
|
inlinestatic |
Acquires access lock (so called RCU reader-side lock)
For safety reasons, it is better to use scoped_lock class for locking/unlocking
|
inlinestatic |
Releases access lock (so called RCU reader-side lock)
For safety reasons, it is better to use scoped_lock class for locking/unlocking
|
inlinestatic |
Forces retired object removal (synchronous version of synchronize)
The function calls synchronize and waits until reclamation thread frees retired objects.
|
inlinestatic |
Checks if the thread is inside read-side critical section (i.e. the lock is acquired)
Usually, this function is used internally to be convinced that subsequent remove action is not lead to a deadlock.
|
inlinestatic |
Retires pointer p by the disposer pFunc.
If the buffer is full, synchronize function is invoked.
|
inlinestatic |
Retires pointer p using Disposer.
If the buffer is full, synchronize function is invoked.
|
inlinestatic |
Retires pointer p of type retired_ptr.
If the buffer is full, synchronize function is invoked.
|
inlinestatic |
Waits to finish a grace period and calls disposing thread.
After grace period finished the function gives new task to disposing thread. Unlike force_dispose the synchronize function does not wait for task ending. Only a "task ready" message is sent to disposing thread.