The Mutex Counter is a counter variable which can safely be incremented or decremented by multiple threads.
More...
#include <thread.h>
|
| | MutexCounter (const char *id=NULL) |
| | Create and optionally name a mutex protected counter.
|
| |
| | MutexCounter (int initial, const char *id=NULL) |
| | Create and optionally name a mutex protected counter with an initial value.
|
| |
| | Mutex (const char *name=NULL) |
| | The mutex is always initialized as a recursive entity.
|
| |
| virtual | ~Mutex () |
| | Destroying the mutex removes any system resources associated with it.
|
| |
| void | nameMutex (const char *name) |
| | Enable setting of mutex name for deadlock debug.
|
| |
| void | enterMutex (void) |
| | Entering a Mutex locks the mutex for the current thread.
|
| |
| void | enter (void) |
| | Future abi will use enter/leave/test members.
|
| |
| void | leave (void) |
| | Future abi will use enter/leave/test members.
|
| |
| bool | test (void) |
| | Future abi will use enter/leave/test members.
|
| |
| bool | tryEnterMutex (void) |
| | Tries to lock the mutex for the current thread.
|
| |
| void | leaveMutex (void) |
| | Leaving a mutex frees that mutex for use by another thread.
|
| |
|
| static void | setDebug (bool mode) |
| | Enable or disable deadlock debugging.
|
| |
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.
- Author
- David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m
Thread protected integer counter.
◆ MutexCounter() [1/2]
| ost::MutexCounter::MutexCounter |
( |
const char * | id = NULL | ) |
|
Create and optionally name a mutex protected counter.
- Parameters
-
| id | name for mutex counter, optional for deadlock testing. |
◆ MutexCounter() [2/2]
| ost::MutexCounter::MutexCounter |
( |
int | initial, |
|
|
const char * | id = NULL ) |
Create and optionally name a mutex protected counter with an initial value.
- Parameters
-
| initial | value of counter. |
| id | name of counter, optional for deadlock testing. |
◆ operator++
◆ operator--
The documentation for this class was generated from the following file: