aboutsummaryrefslogtreecommitdiff
path: root/src/thread_pool.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-08-26 21:30:23 +0100
committergingerBill <bill@gingerbill.org>2021-08-26 21:30:23 +0100
commitac191bd31f2983942e297beba077484ba58922f4 (patch)
tree45ea19933e48a23abab0c4302c9c3115d2ce9be4 /src/thread_pool.cpp
parentad3a3547d61b3576a9b0841510669d0f102f9ccf (diff)
Simplify logic for `-thread-count:1`
Diffstat (limited to 'src/thread_pool.cpp')
-rw-r--r--src/thread_pool.cpp8
1 files changed, 8 insertions, 0 deletions
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);