aboutsummaryrefslogtreecommitdiff
path: root/src/thread_pool.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-12-20 14:08:24 +0000
committergingerBill <bill@gingerbill.org>2022-12-20 14:08:24 +0000
commit134c7db4d21e80751833ed45fb4ace5d0ae3b7d2 (patch)
tree0f6785c36d42766631c42d5d31088541e7024b35 /src/thread_pool.cpp
parenta0e3a99dd165858136dd0d60759b08b22f81cfa2 (diff)
Combine join and destroy for threads
Diffstat (limited to 'src/thread_pool.cpp')
-rw-r--r--src/thread_pool.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/thread_pool.cpp b/src/thread_pool.cpp
index ba150bb6f..a1ee11523 100644
--- a/src/thread_pool.cpp
+++ b/src/thread_pool.cpp
@@ -57,14 +57,9 @@ gb_internal void thread_pool_destroy(ThreadPool *pool) {
for_array(i, pool->threads) {
Thread *t = &pool->threads[i];
- thread_join(t);
+ thread_join_and_destroy(t);
}
-
- for_array(i, pool->threads) {
- Thread *t = &pool->threads[i];
- thread_destroy(t);
- }
-
+
gb_free(pool->allocator, pool->threads.data);
mutex_destroy(&pool->mutex);
condition_destroy(&pool->task_cond);