The AtomicCounter class offers thread-safe manipulation of an integer counter.
More...
#include <thread.h>
The AtomicCounter class offers thread-safe manipulation of an integer counter.
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.
- Author
- Sean Cavanaugh sean@.nosp@m.dime.nosp@m.nsion.nosp@m.alri.nosp@m.ft.co.nosp@m.m atomic counter operation.
Definition at line 535 of file thread.h.
AtomicCounter::AtomicCounter |
( |
| ) |
|
Initialize an atomic counter to 0.
AtomicCounter::AtomicCounter |
( |
int |
value | ) |
|
Initialize an atomic counter to a known value.
- Parameters
-
AtomicCounter::~AtomicCounter |
( |
| ) |
|
AtomicCounter::operator int |
( |
| ) |
|
bool AtomicCounter::operator! |
( |
void |
| ) |
|
int AtomicCounter::operator+ |
( |
int |
change | ) |
|
int AtomicCounter::operator++ |
( |
void |
| ) |
|
int AtomicCounter::operator+= |
( |
int |
change | ) |
|
int AtomicCounter::operator- |
( |
int |
change | ) |
|
int AtomicCounter::operator-- |
( |
void |
| ) |
|
int AtomicCounter::operator-= |
( |
int |
change | ) |
|
int AtomicCounter::operator= |
( |
int |
value | ) |
|
pthread_mutex_t AtomicCounter::_mutex |
|
private |
volatile int AtomicCounter::counter |
|
private |
The documentation for this class was generated from the following file: