Automatically locks and unlocks a ReadWriteLock object. More...
#include <juce_ScopedReadLock.h>
Public Member Functions | |
ScopedReadLock (const ReadWriteLock &lock) noexcept | |
Creates a ScopedReadLock. More... | |
~ScopedReadLock () noexcept | |
Destructor. More... | |
Private Attributes | |
const ReadWriteLock & | lock_ |
Automatically locks and unlocks a ReadWriteLock object.
Use one of these as a local variable to control access to a ReadWriteLock.
e.g.
{Core}
|
inlineexplicitnoexcept |
Creates a ScopedReadLock.
As soon as it is created, this will call ReadWriteLock::enterRead(), and when the ScopedReadLock object is deleted, the ReadWriteLock will be unlocked.
Make sure this object is created and deleted by the same thread, otherwise there are no guarantees what will happen! Best just to use it as a local stack object, rather than creating one with the new() operator.
|
inlinenoexcept |
Destructor.
The ReadWriteLock's exitRead() method will be called when the destructor is called.
Make sure this object is created and deleted by the same thread, otherwise there are no guarantees what will happen!
|
private |