Main Page   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members  

RecursiveMutex Class Reference

#include <RecursiveMutex.h>

Inheritance diagram for RecursiveMutex:

Lockable NonCopyable List of all members.

Public Methods

 RecursiveMutex ()
 Create a new RecursiveMutex.

virtual ~RecursiveMutex () throw ()
 Destroy this RecursiveMutex.

virtual void acquire ()
virtual bool tryAcquire (unsigned long)
virtual void release ()

Detailed Description

Author:
Eric Crahen <crahen@cse.buffalo.edu>
Date:
<2002-06-02T08:11:19-0400>
Version:
2.2.1
A RecursiveMutex is a recursive, MUTual EXclusion Lockable object. It is recursive because it can be acquire()d and release()d more than once by the same thread, instead of causing a Deadlock_Exception.

See also:
Mutex , Guard
Scheduling

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.


Member Function Documentation

virtual void acquire   [virtual]
 

Acquire a RecursiveMutex, possbily blocking until the the current owner of the RecursiveMutex release()es 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.

Exceptions:
Interrupted_Exception  thrown when the calling thread is interupt()ed. A thread may be interrupted at any time, prematurely ending any wait.
Postcondition:
the calling thread succesfully acquire()ed RecursiveMutex only if no exception was thrown.
See also:
Lockable::acquire()

Implements Lockable.

virtual void release   [virtual]
 

Release a RecursiveMutex allowing another thread to acquire() it.

see Lockable::release()

Exceptions:
InvalidOp_Exception  - thrown if there is an attempt to release() this RecursiveMutex from the context of a thread that had not previously acquire()ed it.
Precondition:
the calling thread must have first acquire()d the RecursiveMutex.
Postcondition:
the calling thread succesfully release()d RecursiveMutex only if no exception was thrown.
See also:
Lockable::acquire()

Implements Lockable.

virtual bool tryAcquire unsigned    long [virtual]
 

Acquire a RecursiveMutex, possbily blocking until the the current owner of the RecursiveMutex release()es 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.

Parameters:
timeout  - maximum amount of time (milliseconds) this method could block
Returns :
bool true if the RecursiveMutex was acquire()ed before the timeout expired, otherwise false
Exceptions:
Interrupted_Exception  thrown when the calling thread is interupt()ed. A thread may be interrupted at any time, prematurely ending any wait.
Precondition:
the calling thread must not have already acquire()ed RecursiveMutex
Postcondition:
the calling thread succesfully acquire()ed RecursiveMutex only if no exception was thrown.
See also:
Lockable::tryAcquire(unsigned long)

Implements Lockable.


The documentation for this class was generated from the following file:
Generated on Tue Aug 27 07:43:14 2002 for ZThread by doxygen1.2.17