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

Lockable Class Reference

#include <Lockable.h>

Inheritance diagram for Lockable:

ClassLockable CountingSemaphore FastMutex FastRecursiveMutex Mutex NullLockable PriorityInheritanceMutex PriorityMutex PrioritySemaphore RecursiveMutex Semaphore List of all members.

Public Methods

virtual ~Lockable () throw ()
 Destroy a Lockable object.

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

Detailed Description

Author:
Eric Crahen <crahen@cse.buffalo.edu>
Date:
<2002-05-30T15:28:51-0400>
Version:
2.2.0
The Lockable interface defines a common method of adding general acqurie-release semantics to an object. These acquire-release create a protocol that does not neccessarily imply exclusive access.

The following text describes the specific meaning of acqurie-release semantics in more detail.

Acquiring/Releasing

Acquiring a Lockable object means that a check point has been reached. If execution can continue, the Lockable object may be acquire()d.

Releasing a Lockable object means that a check point is being left.

The details of these semantics are refined further by specializaions of this class, but the general conotation remains intact.

For example, A Mutex class implements the Lockable interface to provide a strict protocol for acquire()ing and release()ing mutually exclusive access to something.

A Semaphore class implements the Lockable interface to define semantics for acquire()ing and release()ing permits for something, which may or may not be exclusive.


Member Function Documentation

virtual void acquire   [pure virtual]
 

Acquire the Lockable object.

This method may or may not block the caller for an indefinite amount of time. Those details are defined by specializations of this class.

Exceptions:
Interrupted_Exception  thrown if the the method is invoked from the context of a thread that has been interrupt()ed.
Synchronization_Exception  thrown if some error occurs while attempting to acquire this Lockable.
Postcondition:
The Lockable is safely acquired if no exception is thrown.

Implemented in ClassLockable, CountingSemaphore, FastMutex, FastRecursiveMutex, Mutex, NullLockable, PriorityInheritanceMutex, PriorityMutex, PrioritySemaphore, RecursiveMutex, and Semaphore.

virtual void release   [pure virtual]
 

Release the Lockable object.

This method may or may not block the caller for an indefinite amount of time. Those details are defined by specializations of this class.

Exceptions:
Interrupted_Exception  thrown if the the method is invoked from the context of a thread that has been interrupt()ed.
Synchronization_Exception  thrown if some error occurs while releasing this Lockable.
Postcondition:
The Lockable is safely released if no exception is thrown.

Implemented in ClassLockable, CountingSemaphore, FastMutex, FastRecursiveMutex, Mutex, NullLockable, PriorityInheritanceMutex, PriorityMutex, PrioritySemaphore, RecursiveMutex, and Semaphore.

virtual bool tryAcquire unsigned    long [pure virtual]
 

Attempt to acquire the Lockable object.

This method may or may not block the caller for a definite amount of time. Those details are defined by specializations of this class; however, this method includes a timeout value that can be used to limit the maximum amount of time that a specialization could block.

Parameters:
timeout  - maximum amount of time (milliseconds) this method could block
Returns :
bool true if the operation completes and the Lockable is acquired before the timeout expires. Otherwise false is returned and the Lockable is not acquired.
Exceptions:
Interrupted_Exception  thrown if the the method is invoked from the context of a thread that has been interrupt()ed.
Synchronization_Exception  thrown if some error occurs while attempting to acquire this Lockable.

Implemented in ClassLockable, CountingSemaphore, FastMutex, FastRecursiveMutex, Mutex, NullLockable, PriorityInheritanceMutex, PriorityMutex, PrioritySemaphore, RecursiveMutex, and Semaphore.


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