#include <thread.h>
Public Member Functions | |
AtomicCounter () | |
Initialize an atomic counter to 0. | |
AtomicCounter (int value) | |
Initialize an atomic counter to a known value. | |
~AtomicCounter () | |
int | operator++ (void) |
int | operator-- (void) |
int | operator+= (int change) |
int | operator-= (int change) |
int | operator+ (int change) |
int | operator- (int change) |
int | operator= (int value) |
bool | operator! (void) |
operator int () |
These are commonly used for building thread-safe "reference" counters for C++ classes. The AtomicCounter depends on the platforms support for "atomic" integer operations, and can alternately substitute a "mutex" if no atomic support exists.
ost::AtomicCounter::AtomicCounter | ( | ) |
Initialize an atomic counter to 0.
ost::AtomicCounter::AtomicCounter | ( | int | value | ) |
Initialize an atomic counter to a known value.
value | initial value. |
ost::AtomicCounter::~AtomicCounter | ( | ) |
int ost::AtomicCounter::operator++ | ( | void | ) |
int ost::AtomicCounter::operator-- | ( | void | ) |
int ost::AtomicCounter::operator+= | ( | int | change | ) |
int ost::AtomicCounter::operator-= | ( | int | change | ) |
int ost::AtomicCounter::operator+ | ( | int | change | ) |
int ost::AtomicCounter::operator- | ( | int | change | ) |
int ost::AtomicCounter::operator= | ( | int | value | ) |
bool ost::AtomicCounter::operator! | ( | void | ) |
ost::AtomicCounter::operator int | ( | ) |