An integer counter whose value is modified in an atomic fashion.
More...
#include <AtomicCounter.h++>
An integer counter whose value is modified in an atomic fashion.
- Author
- Mark Lindner
◆ AtomicCounter() [1/2]
Construct a new AtomicCounter with the given initial value.
- Parameters
-
◆ ~AtomicCounter()
◆ AtomicCounter() [2/2]
◆ get()
Get the current value of the counter.
◆ operator int32_t()
operator int32_t |
( |
| ) |
const |
|
inline |
◆ operator+()
int32_t operator+ |
( |
int32_t |
delta | ) |
const |
Compute the sum of the counter and a value.
◆ operator++() [1/2]
Increment the counter (prefix).
◆ operator++() [2/2]
int32_t operator++ |
( |
int |
| ) |
|
Increment the counter (postfix).
◆ operator+=()
int32_t operator+= |
( |
int32_t |
delta | ) |
|
Add a value to the counter.
◆ operator-()
int32_t operator- |
( |
int32_t |
delta | ) |
const |
Compute the difference between the counter and a value.
◆ operator--() [1/2]
Decrement the counter (prefix).
◆ operator--() [2/2]
int32_t operator-- |
( |
int |
| ) |
|
Decrement the counter (postfix).
◆ operator-=()
int32_t operator-= |
( |
int32_t |
delta | ) |
|
Subtract a value from the counter.
◆ operator=() [1/2]
◆ operator=() [2/2]
int32_t operator= |
( |
int32_t |
value | ) |
|
Assign a new value to the counter.
◆ set()
int32_t set |
( |
int32_t |
value | ) |
|
Assign a new value to the counter, returning the new value.
◆ swap()
int32_t swap |
( |
int32_t |
value | ) |
|
Assign a new value to the counter, returning the previous value.
◆ testAndSet()
int32_t testAndSet |
( |
int32_t |
value, |
|
|
int32_t |
comparand |
|
) |
| |
Test and set the counter value.
- Parameters
-
comparand | The value to compare the counter to. |
value | The value to set the counter to, if the current value is equal to the comparand. |
- Returns
- The original (and possibly unchanged) value of the counter.
The documentation for this class was generated from the following files: