#include <RecursiveMutex.h>
Inheritance diagram for ZThread::RecursiveMutex:
Public Member Functions | |
RecursiveMutex () | |
Create a new RecursiveMutex. | |
virtual | ~RecursiveMutex () |
Destroy this RecursiveMutex. | |
virtual void | acquire () |
virtual bool | tryAcquire (unsigned long timeout) |
virtual void | release () |
Threads competing to acquire() a Mutex are granted access in FIFO order.
Error Checking
A Mutex will throw an InvalidOp_Exception if an attempt to release() a Mutex is made from the context of a thread that does not currently own that Mutex.
void ZThread::RecursiveMutex::acquire | ( | ) | [virtual] |
Acquire a RecursiveMutex, possibly blocking until the the current owner of the releases it or until an exception is thrown.
Only one thread may acquire the RecursiveMutex at any given time. The same thread may acquire a RecursiveMutex multiple times.
Interrupted_Exception | thrown when the calling thread is interrupted. A thread may be interrupted at any time, prematurely ending any wait. |
Implements ZThread::Lockable.
void ZThread::RecursiveMutex::release | ( | ) | [virtual] |
Release exclusive access. No safety or state checks are performed.
Implements ZThread::Lockable.
bool ZThread::RecursiveMutex::tryAcquire | ( | unsigned long | timeout | ) | [virtual] |
Acquire a RecursiveMutex, possibly blocking until the the current owner releases it, until an exception is thrown or until the given amount of time expires.
Only one thread may acquire the RecursiveMutex at any given time. The same thread may acquire a RecursiveMutex multiple times.
timeout | maximum amount of time (milliseconds) this method could block |
Interrupted_Exception | thrown when the calling thread is interrupted. A thread may be interrupted at any time, prematurely ending any wait. |
Implements ZThread::Lockable.