Control Surface  1.2.0
MIDI Control Surface library for Arduino
Mutex.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 struct EmptyMutex {
5  void lock() { /* nothing */ }
6  void unlock() { /* nothing */ }
7 };
8 
10 template <class Mutex>
12  EmptyLockGuard(Mutex &) { /* nothing */ }
13  ~EmptyLockGuard() { /* nothing */ }
14 };
15 
16 #if defined(ESP32) || !defined(ARDUINO)
17 
18 #include <mutex>
19 
20 using DefaultMutEx = std::mutex;
21 template <class Mutex>
22 using DefaultLockGuard = std::lock_guard<Mutex>;
23 
24 #else
25 
27 template <class Mutex>
29 
30 #endif
EmptyLockGuard::~EmptyLockGuard
~EmptyLockGuard()
Definition: Mutex.hpp:13
EmptyMutex::unlock
void unlock()
Definition: Mutex.hpp:6
EmptyMutex
Mutex that doesn't lock anything, used on single-core systems.
Definition: Mutex.hpp:4
EmptyMutex::lock
void lock()
Definition: Mutex.hpp:5
EmptyLockGuard
Lock guard that doesn't lock it's mutex, used on single-core systems.
Definition: Mutex.hpp:11
EmptyLockGuard::EmptyLockGuard
EmptyLockGuard(Mutex &)
Definition: Mutex.hpp:12