#include <Thread.h>
Public Member Functions | |
Mutex () | |
constructor | |
~Mutex () | |
destructor | |
void | set_debug (bool x) |
Sets the debug flags to the value in the input. | |
int | acquire () |
Acquire or lock the mutex. | |
bool | busy () |
Checks whether the mutex is locked or not. | |
int | release () |
Releases the Mutex. | |
Protected Attributes | |
bool | debug |
debugflags | |
pthread_mutex_t | _mtx |
the mutex | |
pthread_t | _owner |
the thread that owns the mutex | |
int | _count |
A counter. |
bool Mutex::busy | ( | ) |
Checks whether the mutex is locked or not.
References _mtx.
int Mutex::release | ( | ) |
Releases the Mutex.
Note: This class emulates a recursive mutex. One needs as many calls to release as calls where made to acquire.
References _count, _mtx, _owner, and debug.
Referenced by DAQpp::DAQmanager::Acquire(), DAQpp::FileIOManager::close(), DAQpp::Monitor::get_event(), DAQpp::FIFO::read(), DAQpp::Monitor::stop_monitor(), DAQpp::Condition::wait(), DAQpp::FileIOManager::write(), and DAQpp::FIFO::write().