#include <yateclass.h>
Public Member Functions | |
Mutex (bool recursive=false, const char *name=0) | |
Mutex (const Mutex &original) | |
~Mutex () | |
Mutex & | operator= (const Mutex &original) |
virtual bool | lock (long maxwait=-1) |
virtual bool | unlock () |
virtual bool | locked () const |
const char * | owner () const |
bool | recursive () const |
Static Public Member Functions | |
static int | count () |
static int | locks () |
static bool | efficientTimedLock () |
Friends | |
class | MutexPrivate |
Mutex support.
A simple mutual exclusion for locking access between threads
Mutex | ( | bool | recursive = false , |
|
const char * | name = 0 | |||
) |
Construct a new unlocked mutex
recursive | True if the mutex has to be recursive (reentrant), false for a normal fast mutex | |
name | Static name of the mutex (for debugging purpose only) |
Copy constructor, creates a shared mutex
original | Reference of the mutex to share |
~Mutex | ( | ) |
Destroy the mutex
static int count | ( | ) | [static] |
Get the number of mutexes counting the shared ones only once
static bool efficientTimedLock | ( | ) | [static] |
Check if a timed lock() is efficient on this platform
virtual bool lock | ( | long | maxwait = -1 |
) | [virtual] |
virtual bool locked | ( | ) | const [virtual] |
Check if the mutex is currently locked - as it's asynchronous it guarantees nothing if other thread changes the mutex's status
Implements Lockable.
static int locks | ( | ) | [static] |
Get the number of currently locked mutexes
Assignment operator makes the mutex shared with the original
original | Reference of the mutex to share |
const char* owner | ( | ) | const |
bool recursive | ( | ) | const |
Check if this mutex is recursive or not
virtual bool unlock | ( | ) | [virtual] |
Unlock the mutex, does never wait
Implements Lockable.