From 134c7db4d21e80751833ed45fb4ace5d0ae3b7d2 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 20 Dec 2022 14:08:24 +0000 Subject: Combine join and destroy for threads --- src/thread_pool.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/thread_pool.cpp') 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); -- cgit v1.2.3