DD::Image::ReadWriteLock Class Reference

List of all members.

Public Member Functions

 ReadWriteLock ()
 ctor creates with defaults
 ~ReadWriteLock ()
 dtor destroys it
void readLock ()
 Lock for reading, this only block writes, not other reads.
bool tryReadLock ()
 Try the lock for reading, this only block writes,.
bool writeLock ()
 lock for writing, this blocks reads and all writes
bool tryWriteLock ()
 lock for writing, this blocks reads and all writes
void unlock ()
 unlock the lock

Protected Attributes

pthread_rwlock_t _lock
 my pthread rwlock that implements this

Detailed Description

A read/write lock that allows multiple readers to gain access to the lock, but only one writer at a time.

The current implementation may not be recursive as I can't figure out how to make it so or if it is so by default.