Main Page Namespace List Class Hierarchy Compound List Compound Members
ZThread::RecursiveMutex Class Reference
#include <RecursiveMutex.h>
Inheritance diagram for ZThread::RecursiveMutex::
List of all members.
Public Methods |
| RecursiveMutex () throw (Synchronization_Exception) |
virtual | ~RecursiveMutex () throw () |
virtual void | acquire () throw (Synchronization_Exception) |
virtual bool | tryAcquire (unsigned long) throw (Synchronization_Exception) |
virtual void | release () throw (Synchronization_Exception) |
Detailed Description
-
Author:
-
Eric Crahen
-
Version:
-
1.3.4
-
Date:
-
04-12-2001
This is an error checking Mutex implementation. Any blocking caused by this mutex can be interrupted. This mutex can also not be deadlocked The performance of this mutex is still fast, but if you really need speed you may want to consider using a FastRecursiveMutex.
Each method is an interruption point Each method will throw a meaningful exception
You should carefully handle exceptions thrown by this mutex.
One major difference in this class is that the same thread can acquire the lock multiple times. It must release it that same number of times
Another is that the release() method will not throw Interrupted_Exceptions The reason for this is to help simplify any nested unlocking that must be performed when a lock is acquire recursively
Constructor & Destructor Documentation
|
Create a new CheckedMutex. -
Exceptions:
-
Initialization_Exception
|
- thrown if resources could not be allocated |
|
~RecursiveMutex (
|
) throw () [virtual]
|
|
Member Function Documentation
|
Lock the mutex and prevent re-entrance on the protected block of code. Calling thread is blocked until the Mutex is released by the thread currently holding its lock
-
See also:
-
Loackable::acquire()
-
Exceptions:
-
Interrupted_Exception
|
- thrown if the calling thread was interrupted prior to this call, or during the time it spends waiting to acquire the mutex |
Deadlock_Exception
|
- NOT thrown because this is a recursive lock. |
Unexpected_Exception
|
- the calling thread was killed and can't be blocked |
Synchronization_Exception
|
- error with the underlying synchronization mechanisms |
Reimplemented from ZThread::Lockable. |
|
Unlock the mutex and prevent re-entrance on the protected block of code. This needs to be called for each acquire() that succeeded.
see Loackable::release()
-
Postcondition:
-
Exceptions are thrown after the release() is performed internally
-
Exceptions:
-
InvalidOp_Exception
|
- thrown if an attempt to release this mutex from a thread that does not own the lock is made |
Synchronization_Exception
|
- error with the underlying synchronization mechanisms |
Reimplemented from ZThread::Lockable. |
|
Lock the mutex and prevent re-entrance on the protected block of code. If the given amount of time expires or the mutex is locked this function returns
see Loackable::tryAcquire() -
Exceptions:
-
Interrupted_Exception
|
- thrown if the calling thread was interrupted prior to this call, or during the time it spends waiting to acquire the mutex |
Deadlock_Exception
|
- NOT thrown because this is a recursive lock. |
Unexpected_Exception
|
- the calling thread was killed and can't be blocked |
Synchronization_Exception
|
- error with the underlying synchronization mechanisms
|
-
Returns:
-
bool indicating the success of the lock attempt
-
Parameters:
-
Reimplemented from ZThread::Lockable. |
The documentation for this class was generated from the following file:
Generated at Fri Aug 31 09:08:01 2001 for ZThread by
1.2.8 written by Dimitri van Heesch,
© 1997-2001