diff --git a/src/unix/threadpool.c b/src/unix/threadpool.c index a1aaa2bd..c7044a5d 100644 --- a/src/unix/threadpool.c +++ b/src/unix/threadpool.c @@ -98,18 +98,17 @@ static void init_once(void) { __attribute__((destructor)) static void cleanup(void) { unsigned int i; - int err; if (initialized == 0) return; post(&exit_message); - for (i = 0; i < ARRAY_SIZE(threads); i++) { - err = pthread_join(threads[i], NULL); - assert(err == 0 || err == ESRCH); - (void) err; /* Silence compiler warning in release builds. */ - } + for (i = 0; i < ARRAY_SIZE(threads); i++) + if (pthread_join(threads[i], NULL)) + abort(); + + initialized = 0; }