JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | List of all members
juce::ScopedReadLock Class Reference

Automatically locks and unlocks a ReadWriteLock object. More...

#include "juce_ScopedReadLock.h"

Public Member Functions

 ScopedReadLock (const ReadWriteLock &lock) noexcept
 Creates a ScopedReadLock.
 
 ~ScopedReadLock () noexcept
 Destructor.
 

Detailed Description

Automatically locks and unlocks a ReadWriteLock object.

Use one of these as a local variable to control access to a ReadWriteLock.

e.g.

for (;;)
{
// myLock is now locked
...do some stuff...
// myLock gets unlocked here.
}
A critical section that allows multiple simultaneous readers.
Automatically locks and unlocks a ReadWriteLock object.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88
See also
ReadWriteLock, ScopedWriteLock

@tags{Core}

Definition at line 51 of file juce_ScopedReadLock.h.

Constructor & Destructor Documentation

◆ ScopedReadLock()

juce::ScopedReadLock::ScopedReadLock ( const ReadWriteLock lock)
explicitnoexcept

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.

Definition at line 65 of file juce_ScopedReadLock.h.

◆ ~ScopedReadLock()

juce::ScopedReadLock::~ScopedReadLock ( )
noexcept

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!

Definition at line 74 of file juce_ScopedReadLock.h.


The documentation for this class was generated from the following file: