The classes and functions in this group make it possible to write multi-threaded programs. Access to shared resources can be serialized by various types of mutexes, semaphores and condition variables. The most lightweight synchronization primitives are atomic integers. The framework allows to start threads, which can be either joinable or detached.
|
class | atomic_t |
| Atomic integers to be used with atomicity functions. More...
|
|
int atomicGet |
( |
volatile atomic_t & |
val | ) |
|
|
related |
Returns the value and employs a memory fence after the get. Acquire semantics prevent memory reordering with any read or write operation which follows it in program order.
void atomicSet |
( |
volatile atomic_t & |
val, |
|
|
int |
n |
|
) |
| |
|
related |
Sets the value and employs a memory fence before the set. Release semantics prevent memory reordering with any read or write operation which precedes it in program order.
int atomicIncrement |
( |
volatile atomic_t & |
val | ) |
|
|
related |
Returns the resulting incremented value.
int atomicDecrement |
( |
volatile atomic_t & |
val | ) |
|
|
related |
Returns the resulting decremented value.
int atomicExchange |
( |
volatile atomic_t & |
val, |
|
|
int |
exch |
|
) |
| |
|
related |
Sets val to exch and returns the initial value of val.
int atomicCompareExchange |
( |
volatile atomic_t & |
val, |
|
|
int |
exch, |
|
|
int |
comp |
|
) |
| |
|
related |
If val is equal to comp, val is replaced by exch. The initial value of of val is returned.
int atomicExchangeAdd |
( |
volatile atomic_t & |
val, |
|
|
int |
add |
|
) |
| |
|
related |
Returns the initial value of the addend.
void * atomicExchange |
( |
void *volatile & |
val, |
|
|
void * |
exch |
|
) |
| |
|
related |
Sets val to exch and returns the initial value of val.
void * atomicCompareExchange |
( |
void *volatile & |
val, |
|
|
void * |
exch, |
|
|
void * |
comp |
|
) |
| |
|
related |
If val is equal to comp, val is replaced by exch. The initial value of ptr is returned.