cds  2.3.2
cds::urcu::general_buffered< Buffer, Lock, Backoff > Class Template Reference

User-space general-purpose RCU with deferred (buffered) reclamation. More...

#include <cds/urcu/general_buffered.h>

Inheritance diagram for cds::urcu::general_buffered< Buffer, Lock, Backoff >:

Public Types

typedef general_buffered_tag rcu_tag
 RCU tag.
 
typedef Buffer buffer_type
 Buffer type.
 
typedef Lock lock_type
 Lock type.
 
typedef Backoff back_off
 Back-off type.
 
typedef base_class::thread_gc thread_gc
 Thread-side RCU part.
 
typedef thread_gc::scoped_lock scoped_lock
 Access lock class.
 

Public Member Functions

virtual void retire_ptr (retired_ptr &p) override
 Retire p pointer. More...
 
template<typename ForwardIterator >
void batch_retire (ForwardIterator itFirst, ForwardIterator itLast)
 Retires the pointer chain [itFirst, itLast)
 
template<typename Func >
void batch_retire (Func e)
 Retires the pointer chain until Func returns nullptr retired pointer.
 
void synchronize ()
 Wait to finish a grace period and then clear the buffer.
 
size_t capacity () const
 Returns internal buffer capacity.
 

Static Public Member Functions

static general_bufferedinstance ()
 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. More...
 
static void Destruct (bool bDetachAll=false)
 Destroys singleton object.
 

Detailed Description

template<class Buffer = cds::container::VyukovMPMCCycleQueue< epoch_retired_ptr >, class Lock = std::mutex, class Backoff = cds::backoff::Default>
class cds::urcu::general_buffered< Buffer, Lock, Backoff >

User-space general-purpose RCU with deferred (buffered) reclamation.

This URCU implementation 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 buffer and all retired objects are freed. This synchronization cycle may be called in any thread that calls retire_ptr function.

The Buffer contains items of epoch_retired_ptr type and it should support a queue interface with three function:

  • bool push( retired_ptr& p ) - places the retired pointer p into queue. If the function returns false it means that the buffer is full and RCU synchronization cycle must be processed.
  • bool pop( retired_ptr& p ) - pops queue's head item into p parameter; if the queue is empty this function must return false
  • size_t size() - returns queue's item count.

The buffer is considered as full if push() returns false or the buffer size reaches the RCU threshold.

There is a wrapper gc<general_buffered> for general_buffered class that provides unified RCU interface. You should use this wrapper class instead general_buffered

Template arguments:

Member Function Documentation

◆ Construct()

template<class Buffer = cds::container::VyukovMPMCCycleQueue< epoch_retired_ptr >, class Lock = std::mutex, class Backoff = cds::backoff::Default>
static void cds::urcu::general_buffered< Buffer, Lock, Backoff >::Construct ( size_t  nBufferCapacity = 256)
inlinestatic

Creates singleton object.

The nBufferCapacity parameter defines RCU threshold.

◆ retire_ptr()

template<class Buffer = cds::container::VyukovMPMCCycleQueue< epoch_retired_ptr >, class Lock = std::mutex, class Backoff = cds::backoff::Default>
virtual void cds::urcu::general_buffered< Buffer, Lock, Backoff >::retire_ptr ( retired_ptr p)
inlineoverridevirtual

Retire p pointer.

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 to free all pointers from the buffer.


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

cds 2.3.2 Developed by Maxim Khizhinsky aka khizmax and other contributors 2007 - 2017
Autogenerated Sun Dec 31 2017 12:10:54 by Doxygen 1.8.13