libcommonc++
0.7
|
A convenience object for lexical scope based synchronization. More...
#include <ScopedReadWriteLock.h++>
Public Member Functions | |
ScopedReadLock (ReadWriteLock &rwlock) | |
Construct a new ScopedReadLock for the given ReadWriteLock. More... | |
~ScopedReadLock () | |
Destructor. More... | |
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 }
|
inline |
Construct a new ScopedReadLock for the given ReadWriteLock.
The lock is locked for read immediately.
|
inline |
Destructor.
Unlocks the ReadWriteLock.