Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

P::RWLock::ReadLock Class Reference
[Core library]

Read Lock Guard class. More...

#include <prwlock.h>

List of all members.

Public Member Functions

 ReadLock (RWLock &lock)
 ~ReadLock ()
ReadLockoperator= (RWLock &mutex)


Detailed Description

Read Lock Guard class.

The lock guard class is used to do exception-safe locking. Simply put a Lock object on the Stack. When the stack-frame is unwinded (by a throw, or a return) the RWLock will be unlocked. The following example shows how to use the Lock guard:

class X {
  void set(int val);
  int get();
  private:
    RWLock rwl;
    int   var;
}

int X::get()
{
  RWLock::ReadLock l(rwl);
  return var;
}

Definition at line 136 of file prwlock.h.


Constructor & Destructor Documentation

P::RWLock::ReadLock::ReadLock RWLock lock  )  [inline]
 

Definition at line 138 of file prwlock.h.

P::RWLock::ReadLock::~ReadLock  )  [inline]
 

Definition at line 141 of file prwlock.h.


Member Function Documentation

ReadLock& P::RWLock::ReadLock::operator= RWLock mutex  )  [inline]
 

Definition at line 144 of file prwlock.h.

References P::RWLock::readLock().


The documentation for this class was generated from the following file:
Generated on Fri Mar 12 21:08:35 2004 for P::Classes by doxygen 1.3.3