X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=utils%2Fthread_util.c;h=6852a2138fa2e64f8d13700a4f122a39aa688976;hb=88cfe534a698a0562e81345957a50714af1453bc;hp=76032c48f14585092e7d523d9d74c078f618e14c;hpb=d5186197bc394e10a4402f7f6d23fbb14103bc50;p=xscreensaver diff --git a/utils/thread_util.c b/utils/thread_util.c index 76032c48..6852a213 100644 --- a/utils/thread_util.c +++ b/utils/thread_util.c @@ -39,7 +39,7 @@ implied warranty. #if defined __MACH__ && defined __APPLE__ /* OS X, iOS */ # include -# include +# include #endif #define IS_POWER_OF_2(x) ((x) > 0 && !((x) & ((x) - 1))) @@ -694,18 +694,16 @@ static void _unlock_and_destroy(struct threadpool *self) PTHREAD_VERIFY(pthread_mutex_unlock(&self->mutex)); - if(!threads) - return; - + if(threads) { unsigned i, count = _threadpool_count_parallel(self); for(i = 0; i != count; ++i) PTHREAD_VERIFY(pthread_join(threads[i], NULL)); - } - free(threads); - PTHREAD_VERIFY(pthread_cond_destroy(&self->cond)); - PTHREAD_VERIFY(pthread_mutex_destroy(&self->mutex)); + free(threads); + PTHREAD_VERIFY(pthread_cond_destroy(&self->cond)); + PTHREAD_VERIFY(pthread_mutex_destroy(&self->mutex)); + } _serial_destroy(self); }