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

ClassLock Class Template Reference

#include <ClassLock.h>

Inheritance diagram for ClassLock:

Lockable List of all members.

Public Methods

virtual ~ClassLock ()
virtual void acquire () throw (Synchronization_Exception)
virtual bool tryAcquire (unsigned long timeout) throw (Synchronization_Exception)
virtual void release () throw (Synchronization_Exception)

Detailed Description

template<typename ClassType, class LockType>
class ZThread::ClassLock< ClassType, LockType >

Author:
Eric Crahen <crahen@cse.buffalo.edu>
Date:
<2002-05-28T19:16:48-0400>
Version:
2.2.0
The ClassLock template creates a Lockable object that delegates to a lock shared among all instances of the class specified in the template parameter.


Member Function Documentation

virtual void acquire   throw (Synchronization_Exception) [inline, 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.

Implements Lockable.

virtual void release   throw (Synchronization_Exception) [inline, 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.

Implements Lockable.

virtual bool tryAcquire unsigned long    timeout throw (Synchronization_Exception) [inline, 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.

Implements Lockable.


The documentation for this class was generated from the following file:
Generated on Thu May 30 17:04:59 2002 for ZThread by doxygen1.2.15