Main Page   Namespace List   Class Hierarchy   Compound List   Compound Members  

ZThread::CheckedMutex Class Reference

#include <CheckedMutex.h>

Inheritance diagram for ZThread::CheckedMutex::

ZThread::Lockable List of all members.

Public Methods

 CheckedMutex () throw (Synchronization_Exception)
virtual ~CheckedMutex () 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 FastMutex.

Each method is an interruption point Each method will throw a meaningful exception

You should carefully handle exceptions thrown by this mutex.


Constructor & Destructor Documentation

CheckedMutex ( ) throw (Synchronization_Exception)
 

Create a new CheckedMutex.

Exceptions:
Initialization_Exception   - thrown if resources could not be allocated

~CheckedMutex ( ) throw () [virtual]
 

Destroy this Mutex


Member Function Documentation

void acquire ( ) throw (Synchronization_Exception) [virtual]
 

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   - thrown if an attempt to acquire this mutex twice with the same thread is made
Unexpected_Exception   - the calling thread was killed and can't be blocked
Synchronization_Exception   - error with the underlying synchronization mechanisms

Reimplemented from ZThread::Lockable.

void release ( ) throw (Synchronization_Exception) [virtual]
 

Unlock the mutex and prevent re-entrance on the protected block of code

see Loackable::release()

Postcondition:
Exceptions are thrown after the release() is performed internally
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
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.

bool tryAcquire ( unsigned long timeout ) throw (Synchronization_Exception) [virtual]
 

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   - thrown if an attempt to acquire this mutex twice with the same thread is made
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:
timeout  

Reimplemented from ZThread::Lockable.


The documentation for this class was generated from the following file:
Generated at Fri Aug 31 09:07:59 2001 for ZThread by doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001