From 8db7e30d35384f6855092eefa79f45f3b2cdc75b Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 26 Oct 2026 20:37:38 -0400 Subject: [PATCH] `should_quit_` now needn't be atomic. --- Concurrency/AsyncTaskQueue.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Concurrency/AsyncTaskQueue.hpp b/Concurrency/AsyncTaskQueue.hpp index 5968f962d..dbd24804f 100644 --- a/Concurrency/AsyncTaskQueue.hpp +++ b/Concurrency/AsyncTaskQueue.hpp @@ -135,7 +135,7 @@ public: if(thread_.joinable()) { enqueue([this] { - should_quit_.test_and_set(); + should_quit_ = true; }); if constexpr (!perform_automatically) { perform(); @@ -201,11 +201,11 @@ private: ActionVector actions; // Continue until told to quit. - while(!should_quit_.test(std::memory_order::relaxed)) { + while(!should_quit_) { // Wait for new actions to be signalled, and grab them. std::unique_lock lock(condition_mutex_); condition_.wait(lock, [&] { - return !actions_.empty() || should_quit_.test(std::memory_order::relaxed); + return !actions_.empty() || should_quit_; }); std::swap(actions, actions_); lock.unlock(); @@ -229,7 +229,7 @@ private: ActionVector actions_; // Necessary synchronisation parts. - std::atomic_flag should_quit_; + bool should_quit_ = false; mutable std::mutex condition_mutex_; std::condition_variable condition_;