Main Page   Namespace List   Class Hierarchy   Compound List   Compound Members  

ZThread::PlainMutex Class Reference

#include <PlainMutex.h>

Inheritance diagram for ZThread::PlainMutex::

ZThread::Lockable List of all members.

Public Methods

 PlainMutex () throw (Synchronization_Exception)
virtual ~PlainMutex () 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.5.0
Date:
07-31-2001

Basic MUTual EXclusion object. Wraps a native mutex providing a minimal amount of functionality.

This mutex will perform checks before a wait is started to see if the thread has been interrupted. However, once a thread is blocked by this mutex it can't be interrupted.

The Mutex class provides a mutex implementation that allows interrupts The CheckedMutex provides a mutex with some error checking functionality


Constructor & Destructor Documentation

PlainMutex ( ) throw (Synchronization_Exception)
 

Allocate a new mutex

Exceptions:
Initialization_Exception   - thrown if there are not enough available resources

~PlainMutex ( ) throw () [virtual]
 

Destroy this PlainMutex object


Member Function Documentation

void acquire ( ) throw (Synchronization_Exception) [virtual]
 

Acquire a lock on this mutex. If the thread has been interrupted before the lock is a acquired this function will throw an exception If the thread is interrupted after it has started to wait for this mutex it can not be interrupted.

Acquiring this mutex twice will result in deadlock.

Exceptions:
Interrupted_Exception   - the calling thread was interrupted before the lock was obtained - not while waiting for the 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.

void release ( ) throw (Synchronization_Exception) [virtual]
 

Release a lock held on this mutex. Releasing a lock twice is not guaranteed to throw an InvalidOp exception. This may have an unpredictable or at least undetected result. It should not be done

Once released, another thread may acquire the mutex.

No interruption checks are performed in this method

Exceptions:
Synchronization_Exception   - error with the underlying synchronization mechanisms

Reimplemented from ZThread::Lockable.

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

Acquire a lock on this mutex. If the thread has been interrupted before the lock is a acquired this function will throw an exception If the thread is interrupted after it has started to wait for this mutex it can not be interrupted.

Acquiring this mutex twice will result in deadlock.

Parameters:
unsigned   long - spend no more than given amount of time waiting for the mutex

Returns:
true if the mutex was acquire in time, false if not
Exceptions:
Interrupted_Exception   - the calling thread was interrupted before the lock was obtained - not while waiting for the lock
Unexpected_Exception   - the calling thread was killed and can't be blocked
Synchronization_Exception   - error with the underlying synchronization mechanisms
Parameters:
timeout  

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 doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001