cds  2.2.0
cds::urcu::signal_buffered< Buffer, Lock, Backoff > Class Template Reference

User-space signal-handled RCU with deferred (buffered) reclamation. More...

#include <cds/urcu/signal_buffered.h>

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

Public Types

typedef signal_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)
 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 the threshold of internal buffer.
 
int signal_no () const
 Returns the signal number stated for RCU.
 

Static Public Member Functions

static signal_bufferedinstance ()
 Returns singleton instance.
 
static bool isUsed ()
 Checks if the singleton is created and ready to use.
 
static void Construct (size_t nBufferCapacity=256, int nSignal=SIGUSR1)
 Creates singleton object. More...
 
static void Destruct (bool bDetachAll=false)
 Destroys singleton object.
 

Static Public Attributes

static bool const c_bBuffered = true
 This RCU buffers disposed elements.
 

Detailed Description

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

User-space signal-handled 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 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<signal_buffered> for signal_buffered class that provides unified RCU interface. You should use this wrapper class instead signal_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::signal_buffered< Buffer, Lock, Backoff >::Construct ( size_t  nBufferCapacity = 256,
int  nSignal = SIGUSR1 
)
inlinestatic

Creates singleton object.

The nBufferCapacity parameter defines RCU threshold.

The nSignal parameter defines a signal number stated for RCU, default is SIGUSR1

§ retire_ptr()

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

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.2.0 Developed by Maxim Khizhinsky aka khizmax 2007 - 2017
Autogenerated Wed Jan 4 2017 08:50:08 by Doxygen 1.8.12