Correct race condition and incorrect usage of condition_signal outside of a mutex lock

This commit is contained in:
gingerBill
2021-08-26 22:17:51 +01:00
parent 726788a483
commit b33bf3f704
5 changed files with 10 additions and 1 deletions

View File

@@ -93,8 +93,8 @@ bool thread_pool_add_task(ThreadPool *pool, WorkerTaskProc *proc, void *data) {
thread_pool_queue_push(pool, task);
GB_ASSERT(pool->ready >= 0);
pool->ready++;
mutex_unlock(&pool->mutex);
condition_signal(&pool->task_cond);
mutex_unlock(&pool->mutex);
return true;
}