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

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

Mutex Lock Guard class. More...

#include <pmutex.h>

List of all members.

Public Member Functions

 Lock (Mutex &mutex)
 ~Lock ()
Lockoperator= (Mutex &mutex)


Detailed Description

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

class X {
  void a(int val);
  private:
    Mutex mtx;
    int   var;
}

void X::a(int val)
{
  Mutex::Lock l(mtx);
  var = val;
}

Definition at line 125 of file pmutex.h.


Constructor & Destructor Documentation

P::Mutex::Lock::Lock Mutex mutex  )  [inline]
 

Definition at line 127 of file pmutex.h.

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

Definition at line 130 of file pmutex.h.


Member Function Documentation

Lock& P::Mutex::Lock::operator= Mutex mutex  )  [inline]
 

Definition at line 133 of file pmutex.h.

References P::Mutex::lock().


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