ScopedReadLock Class Reference

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

#include <ScopedReadWriteLock.h++>

List of all members.

Public Member Functions

 ScopedReadLock (ReadWriteLock &rwlock) throw ()
 Construct a new ScopedReadLock for the given ReadWriteLock.
 ~ScopedReadLock () throw ()
 Destructor.

Detailed Description

A convenience object for lexical scope based synchronization.

ScopedReadLock locks a ReadWriteLock for read at construction time and unlocks it when it is destroyed.

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

 ReadWriteLock rwlock;
 synchronized_read(rwlock)
 {
   // readers-exclusive code here
 }
 
Author:
Mark Lindner

Constructor & Destructor Documentation

ScopedReadLock ( ReadWriteLock rwlock  )  throw () [inline]

Construct a new ScopedReadLock for the given ReadWriteLock.

The lock is locked for read immediately.

~ScopedReadLock (  )  throw () [inline]

Destructor.

Unlocks the ReadWriteLock.


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