ScopedLock Class Reference

A convenience object for lexical scope based synchronization. More...

#include <ScopedLock.h++>

List of all members.

Public Member Functions

 ScopedLock (Lock &lock) throw ()
 Construct a new Scopedock for the given Lock.
 ~ScopedLock () throw ()
 Destructor.

Detailed Description

A convenience object for lexical scope based synchronization.

ScopedLock locks a Lock in its constructor and unlocks it in its destructor.

A block of code can be conveniently protected by a ScopedLock by using the synchronized() macro, e.g.:

 Mutex mutex;
 synchronized(mutex)
 {
   // thread-exclusive code here
 }
 
Author:
Mark Lindner

Constructor & Destructor Documentation

ScopedLock ( Lock lock  )  throw () [inline]

Construct a new Scopedock for the given Lock.

The Lock is locked immediately.

~ScopedLock (  )  throw () [inline]

Destructor.

Unlocks the Lock.


The documentation for this class was generated from the following file:
Generated on Sat Nov 26 16:49:09 2011 for libcommonc++ by  doxygen 1.6.3