Quick Links:

bal | bbl | bdl | bsl

Public Member Functions

bsls::AtomicInt Class Reference

#include <bsls_atomic.h>

List of all members.

Public Member Functions

 AtomicInt ()
 AtomicInt (int value)
 ~AtomicInt ()
AtomicIntoperator= (int value)
int operator+= (int value)
int operator-= (int value)
int operator++ ()
int operator++ (int)
int operator-- ()
int operator-- (int)
int add (int value)
int addAcqRel (int value)
int addRelaxed (int value)
void store (int value)
void storeRelaxed (int value)
void storeRelease (int value)
int subtract (int value)
int subtractAcqRel (int value)
int subtractRelaxed (int value)
int swap (int swapValue)
int swapAcqRel (int swapValue)
int testAndSwap (int compareValue, int swapValue)
int testAndSwapAcqRel (int compareValue, int swapValue)
 operator int () const
int load () const
int loadAcquire () const
int loadRelaxed () const

Detailed Description

This class implements an atomic integer, which supports common integer 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 Component bsls_atomic


Constructor & Destructor Documentation

bsls::AtomicInt::AtomicInt (  ) 

Create an atomic integer object having the default value 0.

bsls::AtomicInt::AtomicInt ( int  value  ) 

Create an atomic integer object having the specified value.

bsls::AtomicInt::~AtomicInt (  ) 

Destroy this atomic integer object.


Member Function Documentation

AtomicInt& bsls::AtomicInt::operator= ( int  value  ) 

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

int bsls::AtomicInt::operator+= ( int  value  ) 

Atomically add the specified value to this object, and return the resulting value.

int bsls::AtomicInt::operator-= ( int  value  ) 

Atomically subtract the specified value from this object, and return the resulting value.

int bsls::AtomicInt::operator++ (  ) 

Atomically increment the value of this object by 1 and return the resulting value.

int bsls::AtomicInt::operator++ ( int   ) 

Atomically increment the value of this object by 1 and return the value prior to being incremented.

int bsls::AtomicInt::operator-- (  ) 

Atomically decrement the value of this object by 1 and return the resulting value.

int bsls::AtomicInt::operator-- ( int   ) 

Atomically decrement the value of this object by 1 and return the value prior to being decremented.

int bsls::AtomicInt::add ( int  value  ) 

Atomically add the specified value to this object and return the resulting value.

int bsls::AtomicInt::addAcqRel ( int  value  ) 

Atomically add the specified value to this object and return the resulting value, providing the acquire/release memory ordering guarantee.

int bsls::AtomicInt::addRelaxed ( int  value  ) 

Atomically add the specified value to this object and return the resulting value, providing the relaxed memory ordering guarantee.

void bsls::AtomicInt::store ( int  value  ) 

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

void bsls::AtomicInt::storeRelaxed ( int  value  ) 

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

void bsls::AtomicInt::storeRelease ( int  value  ) 

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

int bsls::AtomicInt::subtract ( int  value  ) 

Atomically subtract the specified value to this object and return the resulting value.

int bsls::AtomicInt::subtractAcqRel ( int  value  ) 

Atomically subtract the specified value to this object and return the resulting value, providing the acquire/release memory ordering guarantee.

int bsls::AtomicInt::subtractRelaxed ( int  value  ) 

Atomically subtract the specified value to this object and return the resulting value, providing the relaxed memory ordering guarantee.

int bsls::AtomicInt::swap ( int  swapValue  ) 

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

int bsls::AtomicInt::swapAcqRel ( int  swapValue  ) 

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

int bsls::AtomicInt::testAndSwap ( int  compareValue,
int  swapValue 
)

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

int bsls::AtomicInt::testAndSwapAcqRel ( int  compareValue,
int  swapValue 
)

Compare the value of this object to the specified compareValue. If they are equal, set the value of this atomic integer to the specified swapValue, otherwise leave this value unchanged. Return the previous value of this atomic integer, 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.

bsls::AtomicInt::operator int (  )  const

Return the current value of this object.

int bsls::AtomicInt::load (  )  const

Return the current value of this object.

int bsls::AtomicInt::loadAcquire (  )  const

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

int bsls::AtomicInt::loadRelaxed (  )  const

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


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