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

P::CriticalSection::Lock Class Reference
[Core library]

CriticalSection Lock Guard. More...

#include <pcriticalsection.h>

List of all members.

Public Member Functions

 Lock (CriticalSection &cs)
 ~Lock ()
Lockoperator= (CriticalSection &cs)


Detailed Description

CriticalSection Lock Guard.

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 CriticalSection will be unlocked. The following example shows how to use the Lock guard:

class X {
  void a(int val);
  private:
    CriticalSection cs;
    int   var;
}

void X::a(int val)
{
  CriticalSection::Lock l(cs);
  var = val;
}

Definition at line 81 of file pcriticalsection.h.


Constructor & Destructor Documentation

P::CriticalSection::Lock::Lock CriticalSection cs  )  [inline]
 

Definition at line 83 of file pcriticalsection.h.

P::CriticalSection::Lock::~Lock  )  [inline]
 

Definition at line 86 of file pcriticalsection.h.


Member Function Documentation

Lock& P::CriticalSection::Lock::operator= CriticalSection cs  )  [inline]
 

Definition at line 89 of file pcriticalsection.h.

References P::CriticalSection::lock().


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