From bb2c125601b9bc24b83821a76711003f06c58375 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Tue, 28 Dec 2021 22:50:11 -0800 Subject: [PATCH] Utils: Use atomic in VolumeMeter manager --- src/utils/Obs_VolumeMeter.cpp | 2 -- src/utils/Obs_VolumeMeter.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/utils/Obs_VolumeMeter.cpp b/src/utils/Obs_VolumeMeter.cpp index db683db4..92fbe3cf 100644 --- a/src/utils/Obs_VolumeMeter.cpp +++ b/src/utils/Obs_VolumeMeter.cpp @@ -278,9 +278,7 @@ Utils::Obs::VolumeMeter::Handler::~Handler() signal_handler_disconnect(sh, "source_deactivate", Handler::InputDeactivateCallback, this); if (_running) { - _mutex.lock(); _running = false; - _mutex.unlock(); _cond.notify_all(); } diff --git a/src/utils/Obs_VolumeMeter.h b/src/utils/Obs_VolumeMeter.h index 75e46faf..9058fb2d 100644 --- a/src/utils/Obs_VolumeMeter.h +++ b/src/utils/Obs_VolumeMeter.h @@ -87,7 +87,7 @@ namespace Utils { std::mutex _mutex; std::condition_variable _cond; - bool _running; + std::atomic _running; std::thread _updateThread; void UpdateThread();