#include <archon/util/atomic.H>
Collaboration diagram for Archon::Utilities::Atomic:
Public Member Functions | |
Atomic () | |
Atomic (int w) | |
operator int () const | |
Atomic & | operator= (int w) |
Atomic & | operator++ () |
int | operator++ (int) |
Atomic & | operator-- () |
int | operator-- (int) |
Atomic & | operator+= (int w) |
Atomic & | operator-= (int w) |
int | get () const |
Read the value of this integer object atomically. | |
void | set (int w) |
Assign a new value to this integer object atomically. | |
void | inc () |
Increment the value of this integer object atomically. | |
void | dec () |
Decrement the value of this integer object atomically. | |
void | add (int w) |
Add to the value of this integer object atomically. | |
void | sub (int w) |
Subtract from the value of this integer object atomically. | |
bool | decAndZeroTest () |
Decrement the value of this integer object and test if the result is zero. | |
int | fetchAndAdd (int w) |
Add to the value of this integer object and return its original value. | |
bool | testAndSet (int t, int w) |
Assign a new value to this integer object but only if it has a certain original value. |
Useful for reference counting etc..
Inspired by the following implementations of similar functionality:
Currently a fast implementations is only available on Intel 486 and above with GCC.
If you need to port this class to other platforms, then please consult these other implementations.
Definition at line 54 of file atomic.H.
|
Add to the value of this integer object atomically.
Definition at line 281 of file atomic.H. Referenced by operator+=(), and operator-=(). |
|
Decrement the value of this integer object and test if the result is zero. The increment and the test operation is performed as one single atomic operation.
|
|
Add to the value of this integer object and return its original value. The read and the add operation is performed as one single atomic operation.
Definition at line 299 of file atomic.H. Referenced by operator++(), and operator--(). |
|
Read the value of this integer object atomically.
Definition at line 257 of file atomic.H. Referenced by operator int(). |
|
Definition at line 62 of file atomic.H. References get(). |
|
Definition at line 77 of file atomic.H. References fetchAndAdd(). |
|
Definition at line 72 of file atomic.H. References inc(). |
|
Definition at line 92 of file atomic.H. References add(). |
|
Definition at line 87 of file atomic.H. References fetchAndAdd(). |
|
Definition at line 82 of file atomic.H. References dec(). |
|
Definition at line 97 of file atomic.H. References add(). |
|
Definition at line 67 of file atomic.H. References set(). |
|
Assign a new value to this integer object atomically.
Definition at line 263 of file atomic.H. Referenced by Atomic(), and operator=(). |
|
Subtract from the value of this integer object atomically.
|
|
Assign a new value to this integer object but only if it has a certain original value. The test and the assignment operation (if applicable) is performed as one single atomic operation.
|