MADNESS
0.10.1
|
An integer with atomic set, get, read+increment, read+decrement, and decrement+test operations. More...
#include <atomicint.h>
Public Member Functions | |
bool | dec_and_test () |
Decrements the counter and returns true if the new value is zero,. More... | |
operator int () const volatile | |
Returns the value of the counter with fence, ensuring subsequent operations are not moved before the load. More... | |
int | operator++ () |
Increments the counter and returns the incremented value. More... | |
int | operator++ (int) |
Increments the counter and returns the original value. More... | |
int | operator+= (const int inc) |
Add value and return the new value. More... | |
int | operator-- () |
Decrements the counter and returns the decremented value. More... | |
int | operator-- (int) |
Decrements the counter and returns the original value. More... | |
int | operator-= (const int dec) |
Subtract dec and return the new value. More... | |
AtomicInt & | operator= (const AtomicInt &other) |
Sets the value of the counter, with fences to ensure that operations are not moved to either side of the load+store. More... | |
int | operator= (int other) |
Private Types | |
typedef volatile int | atomic_int |
Storage type for the atomic integer. More... | |
Private Member Functions | |
int | exchange_and_add (int i) |
Private Attributes | |
atomic_int | value |
The atomic integer. More... | |
An integer with atomic set, get, read+increment, read+decrement, and decrement+test operations.
Only the default constructor is available and it does \emph not initialize the variable.
Consciously modeled after the TBB API to prepare for switching to it.
|
private |
Storage type for the atomic integer.
|
inline |
Decrements the counter and returns true if the new value is zero,.
Referenced by madness::Barrier::enter(), and madness::detail::RemoteCounterBase::release().
|
inlineprivate |
[in] | i | Description needed. |
References value.
Referenced by operator++(), operator+=(), operator--(), and operator-=().
|
inline |
Returns the value of the counter with fence, ensuring subsequent operations are not moved before the load.
References value.
|
inline |
Increments the counter and returns the incremented value.
References exchange_and_add(), and value.
|
inline |
Increments the counter and returns the original value.
References exchange_and_add(), and value.
|
inline |
Add value
and return the new value.
[in] | inc | The value to be added. |
References exchange_and_add(), and value.
|
inline |
Decrements the counter and returns the decremented value.
References exchange_and_add(), and value.
|
inline |
Decrements the counter and returns the original value.
References exchange_and_add(), and value.
|
inline |
Subtract dec
and return the new value.
[in] | dec | The value to be subtracted. |
References exchange_and_add(), and value.
Sets the value of the counter, with fences to ensure that operations are not moved to either side of the load+store.
[in] | other | The value to set to. |
AtomicInt
.
|
inline |
|
private |
The atomic integer.
Referenced by exchange_and_add(), operator int(), operator++(), operator+=(), operator--(), operator-=(), and operator=().