PWLib
1.10.10
|
#include <critsec.h>
Public Member Functions | |
PAtomicInteger (long v=0) | |
BOOL | IsZero () const |
long | operator++ () |
long | operator-- () |
operator long () const | |
void | SetValue (long v) |
Protected Attributes | |
long | value |
This class implements an integer that can be atomically incremented and decremented in a thread-safe manner. On Windows, the integer is of type long and this class is implemented using InterlockedIncrement and InterlockedDecrement integer is of type long. On Unix systems with GNU std++ support for EXCHANGE_AND_ADD, the integer is of type _Atomic_word (normally int) On all other systems, this class is implemented using PCriticalSection and the integer is of type int.
PAtomicInteger::PAtomicInteger | ( | long | v = 0 | ) | [inline] |
Create a PAtomicInteger with the specified initial value
v | initial value |
BOOL PAtomicInteger::IsZero | ( | ) | const [inline] |
Test if an atomic integer has a zero value. Note that this is a non-atomic test - use the return value of the operator++() or operator--() tests to perform atomic operations
References value.
PAtomicInteger::operator long | ( | ) | const [inline] |
References value.
long PAtomicInteger::operator++ | ( | ) | [inline] |
atomically increment the integer value
References value.
long PAtomicInteger::operator-- | ( | ) | [inline] |
atomically decrement the integer value
References value.
void PAtomicInteger::SetValue | ( | long | v | ) | [inline] |
long PAtomicInteger::value [protected] |
Referenced by IsZero(), operator long(), operator++(), operator--(), and SetValue().