From 1cbc894e6f30eae6fd5fcb9de79df9cf18538a2a Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Thu, 12 Dec 2024 22:53:00 -0500 Subject: [PATCH] task: start up more worker threads when unpausing When paused, TaskConsumer threads will eventually notice the paused condition and exit; however, there's nothing to restart threads when exiting the paused state. When unpausing, and while the lock is already held, create TaskConsumer threads as needed to reach the target thread count. Signed-off-by: Zygo Blaxell --- lib/task.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/task.cc b/lib/task.cc index 3f2a7e8..c839462 100644 --- a/lib/task.cc +++ b/lib/task.cc @@ -645,6 +645,9 @@ namespace crucible { unique_lock lock(m_mutex); m_paused = paused; m_condvar.notify_all(); + if (!m_paused) { + start_threads_nolock(); + } lock.unlock(); }