output/jack: use std::atomic_bool for "shutdown" and "pause"

Without this, the compiler may optimize accesses away.
This commit is contained in:
Max Kellermann 2019-08-04 20:24:51 +02:00
parent f6d0310f9c
commit 848c63e2d5

View File

@ -28,6 +28,8 @@
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "Log.hxx" #include "Log.hxx"
#include <atomic>
#include <assert.h> #include <assert.h>
#include <jack/jack.h> #include <jack/jack.h>
@ -69,13 +71,13 @@ struct JackOutput final : AudioOutput {
jack_client_t *client; jack_client_t *client;
jack_ringbuffer_t *ringbuffer[MAX_PORTS]; jack_ringbuffer_t *ringbuffer[MAX_PORTS];
bool shutdown; std::atomic_bool shutdown;
/** /**
* While this flag is set, the "process" callback generates * While this flag is set, the "process" callback generates
* silence. * silence.
*/ */
bool pause; std::atomic_bool pause;
explicit JackOutput(const ConfigBlock &block); explicit JackOutput(const ConfigBlock &block);