arduino-audio-tools
All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Modules Pages
MutexRP2040.h
1#pragma once
2#include "AudioLogger.h"
3#include "AudioTools/Concurrency/Mutex.h"
4
5namespace audio_tools {
6
14 public:
15 void lock() override {
16 TRACED();
17 noInterrupts();
18 }
19 void unlock() override {
20 TRACED();
21 interrupts();
22 }
23};
24
37class MutexRP2040 : public MutexBase {
38 public:
39 MutexRP2040() {
40 TRACED();
41 mutex_init(&mtx);
42 }
43 virtual ~MutexRP2040() = default;
44
45 void lock() override {
46 TRACED();
47 mutex_enter_blocking(&mtx);
48 }
49 void unlock() override {
50 TRACED();
51 mutex_exit(&mtx);
52 }
53
54 protected:
55 mutex_t mtx;
56};
57
58using Mutex = MutexRP2040;
59
60} // namespace audio_tools
Empty Mutex implementation which does nothing.
Definition Mutex.h:18
Mutex API for non IRQ mutual exclusion between cores. Mutexes are application level locks usually use...
Definition MutexRP2040.h:37
Disable, enable interrupts (only on the actual core)
Definition MutexRP2040.h:13
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition AudioCodecsBase.h:10