Simplify logic for -thread-count:1

This commit is contained in:
gingerBill
2021-08-26 21:30:23 +01:00
parent ad3a3547d6
commit ac191bd31f
2 changed files with 8 additions and 20 deletions

View File

@@ -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);