From 2ff155f74280ea2fdbbeb0536f66b3b04a92930b Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Sun, 5 Feb 2023 17:20:00 +1300 Subject: [PATCH] Optimise cond_var predicate order m_items.empty() is by far the most likely reason for a notification. --- Source/Core/Common/WorkQueueThread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Common/WorkQueueThread.h b/Source/Core/Common/WorkQueueThread.h index f7eb06f82f..be3c3198d4 100644 --- a/Source/Core/Common/WorkQueueThread.h +++ b/Source/Core/Common/WorkQueueThread.h @@ -147,7 +147,7 @@ private: return; m_worker_cond_var.wait( - lg, [&] { return m_shutdown || m_cancelling.load() || !m_items.empty(); }); + lg, [&] { return !m_items.empty() || m_shutdown || m_cancelling.load(); }); } T item{std::move(m_items.front())}; m_items.pop();