|
UCommon
|
The Mutex Counter is a counter variable which can safely be incremented or decremented by multiple threads. More...
#include <thread.h>
Public Member Functions | |
| MutexCounter () | |
| Create and optionally name a mutex protected counter. | |
| MutexCounter (int initial) | |
| Create and optionally name a mutex protected counter with an initial value. | |
| int | operator++ () |
| int | operator-- () |
Protected Attributes | |
| volatile int | counter |
The Mutex Counter is a counter variable which can safely be incremented or decremented by multiple threads.
A Mutex is used to protect access to the counter variable (an integer). An initial value can be specified for the counter, and it can be manipulated with the ++ and – operators.
Thread protected integer counter.
| ost::MutexCounter::MutexCounter | ( | int | initial | ) |
Create and optionally name a mutex protected counter with an initial value.
| initial | value of counter. |