arduino-audio-tools
Loading...
Searching...
No Matches
src
AudioTools
Concurrency
LockGuard.h
1
#pragma once
2
#include "AudioToolsConfig.h"
3
#include "Mutex.h"
4
5
namespace
audio_tools
{
6
17
class
LockGuard
{
18
public
:
19
LockGuard
(
MutexBase
&mutex) {
20
p_mutex = &mutex;
21
p_mutex->lock();
22
}
23
24
LockGuard
(
MutexBase
*mutex) {
25
p_mutex = mutex;
26
if
(p_mutex !=
nullptr
) p_mutex->lock();
27
}
28
29
~LockGuard
() {
30
if
(p_mutex !=
nullptr
) p_mutex->unlock();
31
}
32
33
protected
:
34
MutexBase
*p_mutex =
nullptr
;
35
};
36
37
}
// namespace audio_tools
audio_tools::LockGuard
RAII implementaion using a Mutex: Only a few microcontrollers provide lock guards,...
Definition
LockGuard.h:17
audio_tools::MutexBase
Empty Mutex implementation which does nothing.
Definition
Mutex.h:18
audio_tools
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition
AudioCodecsBase.h:10
Generated by
1.9.8