BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bsls::AtomicBool Class Reference

#include <bsls_atomic.h>

Detailed Description

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).

See bsls_atomic

Public Member Functions

 AtomicBool ()
 
 AtomicBool (bool value)
 
 ~AtomicBool ()=default
 
AtomicBooloperator= (bool value)
 
void store (bool value)
 
void storeRelaxed (bool value)
 
void storeRelease (bool value)
 
bool swap (bool swapValue)
 
bool swapAcqRel (bool swapValue)
 
bool testAndSwap (bool compareValue, bool swapValue)
 
bool testAndSwapAcqRel (bool compareValue, bool swapValue)
 
 operator bool () const
 
bool load () const
 
bool loadRelaxed () const
 
bool loadAcquire () const
 

Constructor & Destructor Documentation

◆ AtomicBool() [1/2]

bsls::AtomicBool::AtomicBool ( )
inline

Create an atomic boolean object having the default value false.

◆ AtomicBool() [2/2]

bsls::AtomicBool::AtomicBool ( bool  value)
inline

Create an atomic boolean object having the specified value.

◆ ~AtomicBool()

bsls::AtomicBool::~AtomicBool ( )
default

Member Function Documentation

◆ load()

bool bsls::AtomicBool::load ( ) const
inline

Return the current value of this object.

◆ loadAcquire()

bool bsls::AtomicBool::loadAcquire ( ) const
inline

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

◆ loadRelaxed()

bool bsls::AtomicBool::loadRelaxed ( ) const
inline

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

◆ operator bool()

bsls::AtomicBool::operator bool ( ) const
inline

Return the current value of this object.

◆ operator=()

AtomicBool & bsls::AtomicBool::operator= ( bool  value)
inline

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

◆ store()

void bsls::AtomicBool::store ( bool  value)
inline

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

◆ storeRelaxed()

void bsls::AtomicBool::storeRelaxed ( bool  value)
inline

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

◆ storeRelease()

void bsls::AtomicBool::storeRelease ( bool  value)
inline

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

◆ swap()

bool bsls::AtomicBool::swap ( bool  swapValue)
inline

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

◆ swapAcqRel()

bool bsls::AtomicBool::swapAcqRel ( bool  swapValue)
inline

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

◆ testAndSwap()

bool bsls::AtomicBool::testAndSwap ( bool  compareValue,
bool  swapValue 
)
inline

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
Note that the entire test-and-swap operation is performed atomically.

◆ testAndSwapAcqRel()

bool bsls::AtomicBool::testAndSwapAcqRel ( bool  compareValue,
bool  swapValue 
)
inline

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
Note that the entire test-and-swap operation is performed atomically and it provides the acquire/release memory ordering guarantee.

The documentation for this class was generated from the following file: