libcommonc++
0.7
|
A convenience object for lexical scope based synchronization. More...
#include <ScopedReadWriteLock.h++>
Public Member Functions | |
ScopedWriteLock (ReadWriteLock &rwlock) | |
Construct a new ScopedWriteLock for the given ReadWriteLock. More... | |
~ScopedWriteLock () | |
Destructor. More... | |
A convenience object for lexical scope based synchronization.
ScopedWriteLock locks a ReadWriteLock for write at construction time and unlocks it when it is destroyed.
A block of code can be conveniently protected by a ScopedWriteLock by using the synchronized_write() macro, e.g.:
ReadWriteLock rwlock;
synchronized_write(rwlock) { // writer-exclusive code here }
|
inline |
Construct a new ScopedWriteLock for the given ReadWriteLock.
The lock is locked for write immediately.
|
inline |
Destructor.
Unlocks the ReadWriteLock.