From ac191bd31f2983942e297beba077484ba58922f4 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 26 Aug 2021 21:30:23 +0100 Subject: Simplify logic for `-thread-count:1` --- src/thread_pool.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/thread_pool.cpp') diff --git a/src/thread_pool.cpp b/src/thread_pool.cpp index b0357996c..a8bc327e5 100644 --- a/src/thread_pool.cpp +++ b/src/thread_pool.cpp @@ -104,6 +104,14 @@ void thread_pool_do_task(WorkerTask *task) { } void thread_pool_wait(ThreadPool *pool) { + if (pool->threads.count == 0) { + while (!thread_pool_queue_empty(pool)) { + thread_pool_do_task(thread_pool_queue_pop(pool)); + --pool->ready; + } + GB_ASSERT(pool->ready == 0); + return; + } for (;;) { mutex_lock(&pool->mutex); -- cgit v1.2.3