Atomic pointer providing sequentially consistent operations by default.

Synopsis

Declared in <bsls_atomic.h>

template<class TYPE>
class AtomicPointer;

Description

This class implements an atomic pointer to a parameterized TYPE, which supports common pointer operations in a way that is guaranteed to be atomic. Operations on objects of this class provide the sequential consistency memory ordering guarantee unless explicitly qualified with a less strict consistency guarantee suffix (i.e., Acquire, Release, AcqRel or Relaxed).

Member Functions

Name

Description

AtomicPointer [constructor]

Constructors

operator=

Atomically assign the specified value to this object, and return a reference offering modifiable access to this object.

load

Return the current value of this object.

loadAcquire

Return the current value of this object, providing the acquire memory ordering guarantee.

loadRelaxed

Return the current value of this object, providing the relaxed memory ordering guarantee.

operator*

Return a reference to the value currently pointed to by this object. The behavior is undefined if this pointer has a value of 0.

operator‐>

Return the current value of this object.

store

Atomically assign the specified value to this object, providing the sequential consistency memory ordering guarantee.

storeRelaxed

Atomically assign the specified value to this object, providing the relaxed memory ordering guarantee.

storeRelease

Atomically assign the specified value to this object, providing the release memory ordering guarantee.

swap

Atomically set the value of this object to the specified swapValue and return its previous value.

swapAcqRel

Atomically set the value of this object to the specified swapValue and return its previous value, providing the acquire/release memory ordering guarantee.

testAndSwap

Conditionally swap this pointer if it equals compareValue.

testAndSwapAcqRel

Conditionally swap this pointer with acquire/release ordering.

operator TYPE*

Return the current value of this object.

Created with MrDocs