diff options
| author | gingerBill <bill@gingerbill.org> | 2023-01-02 17:15:29 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-01-02 17:15:29 +0000 |
| commit | ad52003077d579600d810b1337ca4d7904a1fc9b (patch) | |
| tree | 207811c65395fee8f79a7c80316868ce9daa15be /src/thread_pool.cpp | |
| parent | c38650911267a4ebd12063e69aefa24b783121c7 (diff) | |
Remove some unneeded checks
Diffstat (limited to 'src/thread_pool.cpp')
| -rw-r--r-- | src/thread_pool.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/thread_pool.cpp b/src/thread_pool.cpp index 12a2f9292..f1f19b275 100644 --- a/src/thread_pool.cpp +++ b/src/thread_pool.cpp @@ -142,6 +142,8 @@ gb_internal THREAD_PROC(thread_pool_thread_proc) { while (pool->running.load()) { // If we've got tasks to process, work through them usize finished_tasks = 0; + i32 state; + while (thread_pool_queue_pop(current_thread, &task)) { task.do_work(task.data); pool->tasks_left.fetch_sub(1, std::memory_order_release); @@ -180,7 +182,7 @@ gb_internal THREAD_PROC(thread_pool_thread_proc) { } // if we've done all our work, and there's nothing to steal, go to sleep - i32 state = pool->tasks_available.load(); + state = pool->tasks_available.load(); futex_wait(&pool->tasks_available, state); main_loop_continue:; |