#include <RWLock.h>
Inheritance diagram for ZThread::RWLock::
Public Methods | |
RWLock () throw (Synchronization_Exception) | |
virtual | ~RWLock () throw () |
Lockable* | getReadLock () |
Lockable* | getWriteLock () |
Protected Methods | |
virtual bool | allowReader () |
virtual bool | allowWriter () |
virtual void | beforeRead () throw (Synchronization_Exception) |
virtual void | beforeWrite () throw (Synchronization_Exception) |
virtual bool | beforeRead (unsigned long) throw (Synchronization_Exception) |
virtual bool | beforeWrite (unsigned long) throw (Synchronization_Exception) |
virtual void | postRead () throw (Synchronization_Exception) |
virtual void | postWrite () throw (Synchronization_Exception) |
Protected Attributes | |
FastMutex | _mtxLock |
Serialize access to this object. | |
Condition | _condRead |
Notified on read ready. | |
Condition | _condWrite |
Notified on write read. | |
Lockable* | _readLock |
RLock. | |
Lockable* | _writeLock |
WLock. | |
int | _fairnessCounter |
track fairness. | |
int | _activeReaders |
track the current readers. | |
int | _activeWriters |
track the current writers. | |
int | _waitingReaders |
track the waiting readers. | |
int | _waitingWriters |
track the waiting writers. |
Because the general case where an RWLock would be used is one where you have more readers than writers, this lock will have a bias toward readers
|
Create a new RWLock
|
|
Destroy this RWLock |
|
Checked before a lock is acquired. Changing this function in a subclass can create RWLocks with different biases.
Reimplemented in ZThread::BiasedRWLock, and ZThread::FairRWLock. |
|
Checked before a lock is acquired. Changing this function in a subclass can create RWLocks with different biases.
|
|
Called just before a read lock tryAcquire()
|
|
Called just prior to a read lock acquire() |
|
Called just before a write lock tryAcquire()
|
|
Called just prior to a write lock acquire() |
|
Get a reference to the read lock
|
|
Get a reference to the write lock
|
|
Called after a read lock is released |
|
Called after a write lock is released |