cds
2.3.2
|
Exempt pointer for RCU. More...
#include <cds/urcu/exempt_ptr.h>
Public Types | |
typedef RCU | rcu |
RCU type - one of cds::urcu::gc< ... > | |
typedef NodeType | node_type |
Node type. | |
typedef ValueType | value_type |
Value type. | |
typedef Disposer | disposer |
typedef std::conditional< std::is_same< Cast, void >::value, trivial_cast, Cast >::type | node_to_value_cast |
Functor converting node_type to value_type . | |
Public Member Functions | |
exempt_ptr () noexcept | |
Constructs empty pointer. | |
exempt_ptr (exempt_ptr &&p) noexcept | |
Move ctor. | |
exempt_ptr (exempt_ptr const &)=delete | |
The exempt pointer is not copy-constructible. | |
~exempt_ptr () | |
Releases the pointer, see release() | |
bool | empty () const noexcept |
Checks if the pointer is nullptr . | |
operator bool () const noexcept | |
bool operator returns !empty() | |
value_type * | operator-> () const noexcept |
Dereference operator. | |
value_type & | operator* () noexcept |
Returns a reference to the value. | |
exempt_ptr & | operator= (exempt_ptr &&p) noexcept |
Move assignment. Can be called only outside of RCU critical section. | |
exempt_ptr & | operator= (exempt_ptr const &)=delete |
The exempt pointer is not copy-assignable. | |
void | release () |
Disposes the pointer. Should be called only outside of RCU critical section. | |
Exempt pointer for RCU.
This special pointer class is intended for returning extracted node from RCU-based container. The destructor (and release()
member function) invokes RCU::retire_ptr< Disposer >()
function to dispose the node. For non-intrusive containers from cds::container
namespace Disposer
is usually an invocation of node deallocator. For intrusive containers the disposer can be empty or it can trigger an event "node can be reused safely". In any case, the exempt pointer concept keeps RCU semantics. The destructor or release()
should be called outside the RCU lock of current thread.
You don't need use this helper class directly. Any RCU-based container typedefs a simplified version of this template.
Template arguments:
RCU
- one of RCU typeNodeType
- container's node typeValueType
- value type stored in container's node. For intrusive containers it is the same as NodeType
Disposer
- a disposer functorCast
- a functor for casting from NodeType
to ValueType
. For intrusive containers the casting is usually disabled, i.e. Cast
is void
. typedef Disposer cds::urcu::exempt_ptr< RCU, NodeType, ValueType, Disposer, Cast >::disposer |
Disposer calling when release