|
static plInt32 | Read (const plInt32 &iSrc) |
| Returns src as an atomic operation and returns its value.
|
|
static plInt64 | Read (const plInt64 &iSrc) |
| Returns src as an atomic operation and returns its value.
|
|
static plInt32 | Increment (plInt32 &ref_iDest) |
| Increments dest as an atomic operation and returns the new value.
|
|
static plInt64 | Increment (plInt64 &ref_iDest) |
| Increments dest as an atomic operation and returns the new value.
|
|
static plInt32 | Decrement (plInt32 &ref_iDest) |
| Decrements dest as an atomic operation and returns the new value.
|
|
static plInt64 | Decrement (plInt64 &ref_iDest) |
| Decrements dest as an atomic operation and returns the new value.
|
|
static plInt32 | PostIncrement (plInt32 &ref_iDest) |
| Increments dest as an atomic operation and returns the old value.
|
|
static plInt64 | PostIncrement (plInt64 &ref_iDest) |
| Increments dest as an atomic operation and returns the old value.
|
|
static plInt32 | PostDecrement (plInt32 &ref_iDest) |
| Decrements dest as an atomic operation and returns the old value.
|
|
static plInt64 | PostDecrement (plInt64 &ref_iDest) |
| Decrements dest as an atomic operation and returns the old value.
|
|
static void | Add (plInt32 &ref_iDest, plInt32 value) |
| Adds value to dest as an atomic operation.
|
|
static void | Add (plInt64 &ref_iDest, plInt64 value) |
| Adds value to dest as an atomic operation.
|
|
static void | And (plInt32 &ref_iDest, plInt32 value) |
| Performs an atomic bitwise AND on dest using value.
|
|
static void | And (plInt64 &ref_iDest, plInt64 value) |
| Performs an atomic bitwise AND on dest using value.
|
|
static void | Or (plInt32 &ref_iDest, plInt32 value) |
| Performs an atomic bitwise OR on dest using value.
|
|
static void | Or (plInt64 &ref_iDest, plInt64 value) |
| Performs an atomic bitwise OR on dest using value.
|
|
static void | Xor (plInt32 &ref_iDest, plInt32 value) |
| Performs an atomic bitwise XOR on dest using value.
|
|
static void | Xor (plInt64 &ref_iDest, plInt64 value) |
| Performs an atomic bitwise XOR on dest using value.
|
|
static void | Min (plInt32 &ref_iDest, plInt32 value) |
| Performs an atomic min operation on dest using value.
|
|
static void | Min (plInt64 &ref_iDest, plInt64 value) |
| Performs an atomic min operation on dest using value.
|
|
static void | Max (plInt32 &ref_iDest, plInt32 value) |
| Performs an atomic max operation on dest using value.
|
|
static void | Max (plInt64 &ref_iDest, plInt64 value) |
| Performs an atomic max operation on dest using value.
|
|
static plInt32 | Set (plInt32 &ref_iDest, plInt32 value) |
| Sets dest to value as an atomic operation and returns the original value of dest.
|
|
static plInt64 | Set (plInt64 &ref_iDest, plInt64 value) |
| Sets dest to value as an atomic operation and returns the original value of dest.
|
|
static bool | TestAndSet (plInt32 &ref_iDest, plInt32 iExpected, plInt32 value) |
| If dest is equal to expected, this function sets dest to value and returns true. Otherwise dest will not be modified and the function returns false.
|
|
static bool | TestAndSet (plInt64 &ref_iDest, plInt64 iExpected, plInt64 value) |
| If dest is equal to expected, this function sets dest to value and returns true. Otherwise dest will not be modified and the function returns false.
|
|
static bool | TestAndSet (void **pDest, void *pExpected, void *value) |
| If dest is equal to expected, this function sets dest to value and returns true. Otherwise dest will not be modified and the function returns false.
|
|
static plInt32 | CompareAndSwap (plInt32 &ref_iDest, plInt32 iExpected, plInt32 value) |
| If dest is equal to expected, this function sets dest to value. Otherwise dest will not be modified. Always returns the value of dest before the modification.
|
|
static plInt64 | CompareAndSwap (plInt64 &ref_iDest, plInt64 iExpected, plInt64 value) |
| If dest is equal to expected, this function sets dest to value. Otherwise dest will not be modified. Always returns the value of dest before the modification.
|
|
This class provides functions to do atomic operations.
Atomic operations are generally faster than mutexes, and should therefore be preferred whenever possible. However only the operations in themselves are atomic, once you execute several of them in sequence, the sequence will not be atomic. Also atomic operations are a lot slower than non-atomic operations, thus you should not use them in code that does not need to be thread-safe. plAtomicInteger is built on top of plAtomicUtils and provides a more convenient interface to use atomic integer instructions.