Skip to content

Commit a56dcd7

Browse files
committed
Merge pull request #92 from GregoryComer:win-cleanup-fix
PiperOrigin-RevId: 909035021
2 parents 65eb1fd + 6bde301 commit a56dcd7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/pthreads.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,15 +806,15 @@ void pthreadpool_destroy(struct pthreadpool* threadpool) {
806806
/* Tell all threads to stop. */
807807
pthreadpool_release_all_threads(threadpool);
808808

809-
// Wait for any recruited threads to leave.
810-
wait_on_num_recruited_threads(threadpool, 0);
811-
812809
if (!threadpool->executor.num_threads) {
813810
/* Wait until all threads return */
814811
for (size_t thread = 1; thread < threadpool->max_num_threads; thread++) {
815812
pthreadpool_thread_join(threadpool->threads[thread].thread_object,
816813
NULL);
817814
}
815+
} else {
816+
/* Wait for executor-provided threads. */
817+
wait_on_num_recruited_threads(threadpool, 0);
818818
}
819819

820820
/* Release resources */

0 commit comments

Comments
 (0)