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::GenericScopedLock< LockType > Class Template Reference

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

#include "juce_ScopedLock.h"

Public Member Functions

 GenericScopedLock (const LockType &lock) noexcept
 Creates a GenericScopedLock.
 
 ~GenericScopedLock () noexcept
 Destructor.
 

Detailed Description

template<class LockType>
class juce::GenericScopedLock< LockType >

Automatically locks and unlocks a mutex object.

Use one of these as a local variable to provide RAII-based locking of a mutex.

The templated class could be a CriticalSection, SpinLock, or anything else that provides enter() and exit() methods.

e.g.

for (;;)
{
// myCriticalSection is now locked
...do some stuff...
// myCriticalSection gets unlocked here.
}
Automatically locks and unlocks a mutex 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
GenericScopedUnlock, CriticalSection, SpinLock, ScopedLock, ScopedUnlock

@tags{Core}

Definition at line 54 of file juce_ScopedLock.h.

Constructor & Destructor Documentation

◆ GenericScopedLock()

template<class LockType >
juce::GenericScopedLock< LockType >::GenericScopedLock ( const LockType &  lock)
explicitnoexcept

Creates a GenericScopedLock.

As soon as it is created, this will acquire the lock, and when the GenericScopedLock object is deleted, the lock will be released.

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 67 of file juce_ScopedLock.h.

◆ ~GenericScopedLock()

template<class LockType >
juce::GenericScopedLock< LockType >::~GenericScopedLock ( )
noexcept

Destructor.

The lock will be released 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_ScopedLock.h.


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