aboutsummaryrefslogtreecommitdiff
path: root/src/thread_pool.cpp
diff options
context:
space:
mode:
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);