Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

OW32::CReadWriteLock Class Reference

A read/write lock for N readers, N concurrent with N writers (1 concurrent). More...

#include <ReadWriteLock.h>

List of all members.

Public Member Functions

 CReadWriteLock ()
 Construct the lock object, unlocked.
CSyncObjectGetWriteLock ()
 Return a #CSyncObject corresponding to the write lock for this object.
CSyncObjectGetReadLock ()
 Return a #CSyncObject corresponding to the read lock for this object.


Detailed Description

A read/write lock for N readers, N concurrent with N writers (1 concurrent).

The lock is recursive, but not upgradable. This is handled by an additional reader being counted for each read lock recursion, and a recursion count for each write recursion.

Gives priority to writers (a waiting writer is released before any waiting readers) to prevent writer starvation.

Note that the events are mainly advisory: they do not guarantee freedom to read or write, but merely signal that it is likely. Thus the lock code spins to check the state again. Occasionally, events may be left set in error, which is ok due to the spin.


Member Function Documentation

CSyncObject& OW32::CReadWriteLock::GetReadLock  )  [inline]
 

Return a #CSyncObject corresponding to the read lock for this object.

Returns:
Read lock object

CSyncObject& OW32::CReadWriteLock::GetWriteLock  )  [inline]
 

Return a #CSyncObject corresponding to the write lock for this object.

Returns:
Write lock object


The documentation for this class was generated from the following file:
Generated on Sun Jun 5 01:29:26 2005 for OW32 by  doxygen 1.3.9.1