A critical section that allows multiple simultaneous readers. More...
#include <juce_ReadWriteLock.h>
Public Member Functions | |
ReadWriteLock () noexcept | |
Creates a ReadWriteLock object. | |
~ReadWriteLock () noexcept | |
Destructor. | |
void | enterRead () const noexcept |
Locks this object for reading. | |
bool | tryEnterRead () const noexcept |
Tries to lock this object for reading. | |
void | exitRead () const noexcept |
Releases the read-lock. | |
void | enterWrite () const noexcept |
Locks this object for writing. | |
bool | tryEnterWrite () const noexcept |
Tries to lock this object for writing. | |
void | exitWrite () const noexcept |
Releases the write-lock. | |
A critical section that allows multiple simultaneous readers.
Features of this type of lock are:
|
noexcept |
Creates a ReadWriteLock object.
|
noexcept |
Destructor.
If the object is deleted whilst locked, any subsequent behaviour is undefined.
|
noexcept |
Locks this object for reading.
Multiple threads can simultaneously lock the object for reading, but if another thread has it locked for writing, then this will block until it releases the lock.
|
noexcept |
Tries to lock this object for reading.
Multiple threads can simultaneously lock the object for reading, but if another thread has it locked for writing, then this will fail and return false.
|
noexcept |
Releases the read-lock.
If the caller thread hasn't got the lock, this can have unpredictable results.
If the enterRead() method has been called multiple times by the thread, each call must be matched by a call to exitRead() before other threads will be allowed to take over the lock.
|
noexcept |
Locks this object for writing.
This will block until any other threads that have it locked for reading or writing have released their lock.
|
noexcept |
Tries to lock this object for writing.
This is like enterWrite(), but doesn't block - it returns true if it manages to obtain the lock.
|
noexcept |
Releases the write-lock.
If the caller thread hasn't got the lock, this can have unpredictable results.
If the enterWrite() method has been called multiple times by the thread, each call must be matched by a call to exit() before other threads will be allowed to take over the lock.