diff options
author | Max Kellermann <max@musicpd.org> | 2019-08-04 20:24:51 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-08-06 11:34:00 +0200 |
commit | 848c63e2d55130c4e2ed3f3ef71ed9ea99a8bdba (patch) | |
tree | 4d885053d67f21a403969e768a3c2fa8451b197c | |
parent | f6d0310f9c553f1e991c933512eb8d81a606344f (diff) |
output/jack: use std::atomic_bool for "shutdown" and "pause"
Without this, the compiler may optimize accesses away.
-rw-r--r-- | src/output/plugins/JackOutputPlugin.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/output/plugins/JackOutputPlugin.cxx b/src/output/plugins/JackOutputPlugin.cxx index 5b7a2fe2e..9204e9c1f 100644 --- a/src/output/plugins/JackOutputPlugin.cxx +++ b/src/output/plugins/JackOutputPlugin.cxx @@ -28,6 +28,8 @@ #include "util/Domain.hxx" #include "Log.hxx" +#include <atomic> + #include <assert.h> #include <jack/jack.h> @@ -69,13 +71,13 @@ struct JackOutput final : AudioOutput { jack_client_t *client; jack_ringbuffer_t *ringbuffer[MAX_PORTS]; - bool shutdown; + std::atomic_bool shutdown; /** * While this flag is set, the "process" callback generates * silence. */ - bool pause; + std::atomic_bool pause; explicit JackOutput(const ConfigBlock &block); |