From 4affbe70b6f2342c479eb71f9a5df26fed9dccca Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 10 Oct 2012 01:09:45 +0200 Subject: [PATCH] unix: remove unnecessary pthread_join ESRCH check ESRCH means the thread never got started but we guard against that now. --- src/unix/threadpool.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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; }