A reentrant mutex. More...
#include "reMutex.h"
Public Member Functions | |
ReMutex (const char *name) | |
ReMutex (const std::string &name) | |
ReMutex (const ReMutex ©)=delete | |
void | operator= (const ReMutex ©)=delete |
![]() | |
void | acquire () const |
Grabs the reMutex if it is available. More... | |
void | acquire (Thread *current_thread) const |
This variant on acquire() accepts the current thread as a parameter, if it is already known, as an optimization. More... | |
void | clear_name () |
The mutex name is only defined when compiling in DEBUG_THREADS mode. More... | |
bool | debug_is_locked () const |
Returns true if the current thread has locked the ReMutex, false otherwise. More... | |
void | elevate_lock () const |
This method increments the lock count, assuming the calling thread already holds the lock. More... | |
std::string | get_name () const |
The mutex name is only defined when compiling in DEBUG_THREADS mode. More... | |
bool | has_name () const |
The mutex name is only defined when compiling in DEBUG_THREADS mode. More... | |
void | lock () |
Alias for acquire() to match C++11 semantics. More... | |
void | output (std::ostream &out) const |
This method is declared virtual in MutexDebug, but non-virtual in ReMutexDirect. More... | |
void | release () const |
Releases the reMutex. More... | |
void | set_name (const std::string &name) |
The mutex name is only defined when compiling in DEBUG_THREADS mode. More... | |
bool | try_acquire () const |
Returns immediately, with a true value indicating the mutex has been acquired, and false indicating it has not. More... | |
bool | try_acquire (Thread *current_thread) const |
Returns immediately, with a true value indicating the mutex has been acquired, and false indicating it has not. More... | |
bool | try_lock () |
Alias for try_acquire() to match C++11 semantics. More... | |
void | unlock () |
Alias for release() to match C++11 semantics. More... | |
A reentrant mutex.
This kind of mutex can be locked more than once by the thread that already holds it, without deadlock. The thread must eventually release the mutex the same number of times it locked it.
This class inherits its implementation either from MutexDebug or ReMutexDirect, depending on the definition of DEBUG_THREADS.