OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
audio_lock.hpp
1#pragma once
2
3#include <ossia/detail/config.hpp>
4
5#include <ossia/detail/audio_spin_mutex.hpp>
6#include <ossia/detail/mutex.hpp>
7
8#include <mutex>
9
10#if defined(OSSIA_PARALLEL)
11using ossia_audio_lock_t = std::unique_lock<ossia::audio_spin_mutex>;
12#define OSSIA_EXEC_STATE_LOCK_READ(state) \
13 ossia_audio_lock_t ossia_read_lock \
14 { \
15 (state).mutex \
16 }
17#define OSSIA_EXEC_STATE_LOCK_WRITE(state) \
18 ossia_audio_lock_t ossia_write_lock \
19 { \
20 (state).mutex \
21 }
22#else
23struct ossia_audio_lock_t
24{
25 void lock() { }
26 void unlock() { }
27};
28#define OSSIA_EXEC_STATE_LOCK_READ(state) \
29 ossia_audio_lock_t ossia_read_lock; \
30 (void)ossia_read_lock;
31#define OSSIA_EXEC_STATE_LOCK_WRITE(state) \
32 ossia_audio_lock_t ossia_write_lock; \
33 (void)ossia_write_lock;
34#endif