cds
2.3.2
|
Raw pointer to node of RCU-based container. More...
#include <cds/urcu/raw_ptr.h>
Public Types | |
typedef RCU | rcu |
RCU type - one of cds::urcu::gc< ... > | |
typedef ValueType | value_type |
Value type pointed by raw_ptr . | |
typedef ReclaimedEnumerator | reclaimed_enumerator |
implementation-defined, for internal use only | |
Public Member Functions | |
raw_ptr () | |
Constructs an empty raw pointer. | |
raw_ptr (raw_ptr &&p) | |
Move ctor. | |
raw_ptr (raw_ptr const &)=delete | |
Copy ctor is prohibited. | |
~raw_ptr () | |
Releases the raw pointer. | |
raw_ptr & | operator= (raw_ptr &&p) noexcept |
Move assignment operator. More... | |
raw_ptr & | operator= (raw_ptr const &)=delete |
Copy assignment is prohibited. | |
value_type * | operator-> () const noexcept |
Returns a pointer to stored value. | |
value_type & | operator* () |
Returns a reference to stored value. | |
value_type const & | operator* () const |
Returns a reference to stored value. | |
bool | empty () const noexcept |
Checks if the raw_ptr is nullptr . | |
operator bool () const noexcept | |
Checks if the raw_ptr is not empty. | |
void | release () |
Releases the raw_ptr object. More... | |
Raw pointer to node of RCU-based container.
This class is intented for returning a pointer to node of RCU-based container. The objects of raw_ptr
class is returned by functions like get()
of that containers. Those functions must be called only under RCU-lock, otherwise the node returned can be reclaimed. On the other hand, traversing the container can remove a lot of nodes marked as deleted ones. Since RCU is locked, such nodes cannot be reclaimed immediately and must be retired only outside RCU lock.
The object of raw_ptr
solves that problem: it contains the pointer to the node found and a chain of nodes that were be reclaimed during traversing. The raw_ptr
object destructor frees the chain (but not the node found) passing it to RCU batch_retire()
.
The object of raw_ptr
class must be destructed only outside RCU-lock of current thread.
Usually, you do not need to use raw_ptr
class directly. Each RCU container declares a raw_ptr
typedef suitable for the container.
Template arguments:
RCU
- one of RCU typeValueType
- type of values stored in containerReclaimedEnumerator
- implementation-defined for each type of containerExample: let Container
is an RCU container
|
inlinenoexcept |
Move assignment operator.
This operator may be called only inside RCU-lock.
|
inline |
Releases the raw_ptr
object.
This function may be called only outside RCU locked region. After release
() the object becomes empty and can be reused.