|
libpsynth 0.2.1
|
A lock that implements mutual exclusion for writers but allows multiple readers. More...
#include <mutex.hpp>
Public Types | |
| enum | type { DEFAULT } |
Public Member Functions | |
| rwlock (int type=DEFAULT) | |
| Constructor. | |
| ~rwlock () | |
| Destructor. | |
| void | read_lock () const |
| Locks as a reader. | |
| void | write_lock () const |
| Locks as a writer. | |
| bool | try_read_lock () const |
Tries to do a readLock. | |
| bool | try_write_lock () |
Tries to do a writeLock. | |
| void | unlock () const |
Unlocks the RWLock. | |
A lock that implements mutual exclusion for writers but allows multiple readers.
| enum psynth::rwlock::type |
| psynth::rwlock::rwlock | ( | int | type = DEFAULT | ) | [inline] |
Constructor.
| type | The type of lock, defaults to DEFAULT. |
| psynth::rwlock::~rwlock | ( | ) | [inline] |
Destructor.
| void psynth::rwlock::read_lock | ( | ) | const [inline] |
Locks as a reader.
It will block it is currently locked by a writer or if any writer is willing to lock it when using PREFER_WRITER type.
| bool psynth::rwlock::try_read_lock | ( | ) | const [inline] |
Tries to do a readLock.
true if we could lock the RWLock and false if it was already locked. | bool psynth::rwlock::try_write_lock | ( | ) | [inline] |
Tries to do a writeLock.
true if we could lock the RWLock and false if it was already locked. | void psynth::rwlock::unlock | ( | ) | const [inline] |
Unlocks the RWLock.
| void psynth::rwlock::write_lock | ( | ) | const [inline] |
Locks as a writer.
It will block if the lock is locked is already locked by anyone, reader or writer.
1.7.4