This class implements an atomic boolean, which supports common boolean 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).

Synopsis

Declared in <bsls_atomic.h>

class AtomicBool;

Member Functions

Name

Description

AtomicBool [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.

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

Compare the value of this object to the specified compareValue. If they are equal, set the value of this atomic boolean to the specified swapValue, otherwise leave this value unchanged. Return the previous value of this atomic boolean, whether or not the swap occurred. Note that the entire test‐and‐swap operation is performed atomically.

testAndSwapAcqRel

Compare the value of this object to the specified compareValue. If they are equal, set the value of this atomic boolean to the specified swapValue, otherwise leave this value unchanged. Return the previous value of this atomic boolean, whether or not the swap occurred. Note that the entire test‐and‐swap operation is performed atomically and it provides the acquire/release memory ordering guarantee.

operator bool

Return the current value of this object.

Created with MrDocs