]> git.hungrycats.org Git - bees/commitdiff
task: start up more worker threads when unpausing
authorZygo Blaxell <bees@furryterror.org>
Fri, 13 Dec 2024 03:53:00 +0000 (22:53 -0500)
committerZygo Blaxell <bees@furryterror.org>
Fri, 13 Dec 2024 03:53:00 +0000 (22:53 -0500)
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 <bees@furryterror.org>
lib/task.cc

index 3f2a7e8ec0745699a2f85b4882046eb911324a9b..c8394620f951f5bf236509ba69781e370102d86d 100644 (file)
@@ -645,6 +645,9 @@ namespace crucible {
                unique_lock<mutex> lock(m_mutex);
                m_paused = paused;
                m_condvar.notify_all();
+               if (!m_paused) {
+                       start_threads_nolock();
+               }
                lock.unlock();
        }