User-space general-purpose RCU with deferred threaded reclamation. More...
|Buffer type. |
|Lock type. |
|Back-off scheme. |
|Disposer thread type. |
|Thread-side RCU part. |
|Access lock class. |
|Access lock class. |
|virtual void||retire_ptr (retired_ptr &p)|
|template<typename ForwardIterator >|
|void||batch_retire (ForwardIterator itFirst, ForwardIterator itLast)|
|Retires the pointer chain [|
|template<typename Func >|
|void||batch_retire (Func e)|
|Retires the pointer chain until |
|Waits to finish a grace period and calls disposing thread. |
|size_t||capacity () const|
|Returns the threshold of internal buffer. |
|static general_threaded *||instance ()|
|Returns singleton instance. |
|static bool||isUsed ()|
|Checks if the singleton is created and ready to use. |
|static void||Construct (size_t nBufferCapacity=256)|
|Creates singleton object and starts reclamation thread. More...|
|static void||Destruct (bool bDetachAll=false)|
|Destroys singleton object and terminates internal reclamation thread. |
|static bool const||c_bBuffered = true|
|This RCU buffers disposed elements. |
User-space general-purpose RCU with deferred threaded reclamation.
This implementation is similar to general_buffered but separate thread is created for deleting the retired objects. Like
general_buffered, the class contains an internal buffer where retired objects are accumulated. When the buffer becomes full, the RCU
synchronize() function is called that waits until all reader/updater threads end up their read-side critical sections, i.e. until the RCU quiescent state will come. After that the "work ready" message is sent to reclamation thread. The reclamation thread frees the buffer. This synchronization cycle may be called in any thread that calls
There is a wrapper gc<general_threaded> for
general_threaded class that provides unified RCU interface. You should use this wrapper class instead
Buffer contains items of epoch_retired_ptr type
and it should support a multiple producer/single consumer queue with the following interface:
bool push( epoch_retired_ptr& p )- places the retired pointer
pinto queue. If the function returns
falseit means that the buffer is full and RCU synchronization cycle must be processed.
epoch_retired_ptr * front()- returns a pointer to the top element or
nullptrif the buffer is empty.
bool pop_front()- pops the top element; returns
falseif the buffer is empty.
size_t size()- returns queue's item count.
The buffer is considered as full if
false or the buffer size reaches the RCU threshold.
Buffer - MPSC (muliple producer/single consumer) buffer type with FIFO semantics.
cds::container::VyukovMPSCCycleQueue. The buffer contains the objects of epoch_retired_ptr type that contains additional
m_nEpoch field. This field specifies an epoch when the object has been placed into the buffer. The
general_threaded object has a global epoch counter that is incremented on each
synchronize() call. The epoch is used internally to prevent early deletion.
Lock- mutex type, default is
DisposerThread- the reclamation thread class. Default is cds::urcu::dispose_thread, see the description of this class for required interface.
Backoff- back-off schema, default is cds::backoff::Default
Creates singleton object and starts reclamation thread.
nBufferCapacity parameter defines RCU threshold.
The method pushes
p pointer to internal buffer. When the buffer becomes full synchronize function is called to wait for the end of grace period and then a message is sent to the reclamation thread.