If you can read this text, it means you are not experiencing this website at its best. This website is designed for used with a standards-compliant browser.
Current version: 2.3.2
ZThreads
A platform-independent, multi-threading and synchronization library for C++
Home Documentation Downloads CVS Contact

Lockable Class Reference

#include <Lockable.h>

Inheritance diagram for Lockable:

BlockingQueue BoundedQueue ClassLockable CountingSemaphore FastMutex FastRecursiveMutex MonitoredQueue Mutex PriorityInheritanceMutex PriorityMutex PrioritySemaphore RecursiveMutex Semaphore List of all members.

Public Member Functions

virtual ~Lockable ()
 Destroy a Lockable object.
virtual void acquire ()=0
virtual bool tryAcquire (unsigned long timeout)=0
virtual void release ()=0

Detailed Description

Author:
Eric Crahen <http://www.code-foo.com>
Date:
<2003-07-16T10:33:32-0400>
Version:
2.3.0
The Lockable interface defines a common method of adding general acquire-release semantics to an object. An acquire-release protocol does not necessarily imply exclusive access.


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 calling thread is interrupted before the operation completes.
Postcondition:
The Lockable is acquired only if no exception was thrown.

Implemented in BlockingQueue, BoundedQueue, ClassLockable, CountingSemaphore, FastMutex, FastRecursiveMutex, MonitoredQueue, Mutex, 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.

Postcondition:
The Lockable is released only if no exception was thrown.

Implemented in BlockingQueue, BoundedQueue, ClassLockable, CountingSemaphore, FastMutex, FastRecursiveMutex, MonitoredQueue, Mutex, PriorityInheritanceMutex, PriorityMutex, PrioritySemaphore, RecursiveMutex, and Semaphore.

virtual bool tryAcquire unsigned long  timeout  )  [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:
  • true if the operation completes and the Lockable is acquired before the timeout expires.
  • false if the operation times out before the Lockable can be acquired.
Exceptions:
Interrupted_Exception thrown if the calling thread is interrupted before the operation completes.
Postcondition:
The Lockable is acquired only if no exception was thrown.

Implemented in BlockingQueue, BoundedQueue, ClassLockable, CountingSemaphore, FastMutex, FastRecursiveMutex, MonitoredQueue, Mutex, PriorityInheritanceMutex, PriorityMutex, PrioritySemaphore, RecursiveMutex, and Semaphore.


The documentation for this class was generated from the following file: