#include <Lockable.h>
Inheritance diagram for ZThread::Lockable::
Public Methods | |
virtual void | release ()=0 throw (Synchronization_Exception) |
virtual void | acquire ()=0 throw (Synchronization_Exception) |
virtual bool | tryAcquire (unsigned long)=0 throw (Synchronization_Exception) |
Literature on this subject often refers to P() & V() functions; these functions map to this class type as shown below.
P() => acquire() : Acquire a lock V() => release() : Release a lock
The meaning of these phrases can vary from implementation to implementation. For instance, acquire a lock on a mutex means you have exclusive control of that lock. Acquiring a lock on a semaphore means you have acquired a permit and do not necessarily have exclusive control of the object.
All of these methods can possibly block the calling thread for some period of time. This depends on the implementation, so you should assume that a call will block unless you know that the specific Lockable implementation won't block.
|
P() - Acquire Acquire a lock.
Reimplemented in ZThread::Barrier, ZThread::CheckedMutex, ZThread::CountingSemaphore, ZThread::Latch, ZThread::Mutex, ZThread::NullMutex, ZThread::PlainMutex, ZThread::FastMutex, ZThread::FastRecursiveMutex, ZThread::RecursiveMutex, ZThread::WLock, ZThread::RLock, and ZThread::Semaphore. |
|
V() - Release Release a lock. If an exception is thrown the state of this object is not altered.
Reimplemented in ZThread::Barrier, ZThread::CheckedMutex, ZThread::CountingSemaphore, ZThread::Latch, ZThread::Mutex, ZThread::NullMutex, ZThread::PlainMutex, ZThread::FastMutex, ZThread::FastRecursiveMutex, ZThread::RecursiveMutex, ZThread::WLock, ZThread::RLock, and ZThread::Semaphore. |
|
P() - Acquire Acquire a lock.
Reimplemented in ZThread::Barrier, ZThread::CheckedMutex, ZThread::CountingSemaphore, ZThread::Latch, ZThread::Mutex, ZThread::NullMutex, ZThread::PlainMutex, ZThread::FastMutex, ZThread::FastRecursiveMutex, ZThread::RecursiveMutex, ZThread::WLock, ZThread::RLock, and ZThread::Semaphore. |