Public Member Functions |
| | Atomic (const T v=0) |
| | Construct a new atomic variable with an initial value.
|
| | Atomic (const Atomic< T > &v) |
| | Construct a copy of an atomic variable.
|
| | operator T (void) const |
| void | operator= (const T v) |
| | Assign a new value.
|
| void | operator= (const Atomic< T > &v) |
| | Assign a new value.
|
| T | operator+= (T v) |
| | Atomically add a value and return the new value.
|
| T | operator-= (T v) |
| | Atomically substract a value and return the new value.
|
| T | operator++ (void) |
| | Atomically increment by one and return the new value.
|
| T | operator-- (void) |
| | Atomically decrement by one and return the new value.
|
| T | operator++ (int) |
| | Atomically increment by one and return the old value.
|
| T | operator-- (int) |
| | Atomically decrement by one and return the old value.
|
template<typename T>
class co::base::Atomic< T >
An variable with atomic operations.
Atomic variables can be modified safely from multiple threads concurrently. They are useful to implement lock-free algorithms.
For implementation reasons, only signed atomic variables are supported, of which only int32_t is implemented right now.
Definition at line 39 of file atomic.h.