WE Core
|
#include <AudioSpinMutex.h>
Public Member Functions | |
AudioSpinMutex ()=default | |
~AudioSpinMutex ()=default | |
void | lock () |
bool | tryLock () |
void | unlock () |
Private Attributes | |
std::atomic_flag | flag = ATOMIC_FLAG_INIT |
Provides mutex that the audio thread can try-lock in a realtime safe way.
Based on the implementation described here: https://timur.audio/using-locks-in-real-time-audio-processing-safely
Definition at line 46 of file AudioSpinMutex.h.
|
default |
|
default |
|
inline |
Call from the non-realtime thread.
Will block until the mutex is locked.
Definition at line 56 of file AudioSpinMutex.h.
References tryLock().
Referenced by WECore::AudioSpinLock::AudioSpinLock().
|
inline |
Returns true if the lock was successful.
Is safe to call from the audio thread.
Definition at line 102 of file AudioSpinMutex.h.
References flag.
Referenced by WECore::AudioSpinTryLock::AudioSpinTryLock(), and lock().
|
inline |
Call to unlock the mutex.
Definition at line 109 of file AudioSpinMutex.h.
References flag.
Referenced by WECore::AudioSpinLockBase::unlock(), and WECore::AudioSpinLockBase::~AudioSpinLockBase().
|
private |
Definition at line 114 of file AudioSpinMutex.h.