We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 65eb1fd + 6bde301 commit a56dcd7Copy full SHA for a56dcd7
1 file changed
src/pthreads.c
@@ -806,15 +806,15 @@ void pthreadpool_destroy(struct pthreadpool* threadpool) {
806
/* Tell all threads to stop. */
807
pthreadpool_release_all_threads(threadpool);
808
809
- // Wait for any recruited threads to leave.
810
- wait_on_num_recruited_threads(threadpool, 0);
811
-
812
if (!threadpool->executor.num_threads) {
813
/* Wait until all threads return */
814
for (size_t thread = 1; thread < threadpool->max_num_threads; thread++) {
815
pthreadpool_thread_join(threadpool->threads[thread].thread_object,
816
NULL);
817
}
+ } else {
+ /* Wait for executor-provided threads. */
+ wait_on_num_recruited_threads(threadpool, 0);
818
819
820
/* Release resources */
0 commit comments