From f10ed21255e52ff6a92736a141c4fcf99b270e38 Mon Sep 17 00:00:00 2001 From: Pedro Cuadra Date: Mon, 14 Jul 2025 06:58:27 -0600 Subject: [PATCH] Join all threads on thpool_destroy After the jobqueue is already destroyed all the threads should be already down. Call pthread_join on all threads for symmetry. Also, tools like Valgrind and Helgrind my complain if pthread_join is not called. --- thpool.c | 1 + 1 file changed, 1 insertion(+) diff --git a/thpool.c b/thpool.c index 83885c3..2262ac2 100644 --- a/thpool.c +++ b/thpool.c @@ -254,6 +254,7 @@ void thpool_destroy(thpool_* thpool_p){ /* Deallocs */ int n; for (n=0; n < threads_total; n++){ + pthread_join(thpool_p->threads[n]->pthread, NULL); thread_destroy(thpool_p->threads[n]); } free(thpool_p->threads);