From: Howard Chu Date: Wed, 18 Jan 2006 01:55:24 +0000 (+0000) Subject: ITS#4349 don't wait on condition if there are no threads in the pool. X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~292 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=84315e96f80d593ad8b8363e08d250e3fcccff2b;p=openldap ITS#4349 don't wait on condition if there are no threads in the pool. --- diff --git a/libraries/libldap_r/tpool.c b/libraries/libldap_r/tpool.c index 56e8f54687..21d98d6465 100644 --- a/libraries/libldap_r/tpool.c +++ b/libraries/libldap_r/tpool.c @@ -507,8 +507,10 @@ ldap_pvt_thread_pool_destroy ( ldap_pvt_thread_pool_t *tpool, int run_pending ) ? LDAP_INT_THREAD_POOL_FINISHING : LDAP_INT_THREAD_POOL_STOPPING; - ldap_pvt_thread_cond_broadcast(&pool->ltp_cond); - ldap_pvt_thread_cond_wait(&pool->ltp_cond, &pool->ltp_mutex); + if ( pool->ltp_open_count ) { + ldap_pvt_thread_cond_broadcast(&pool->ltp_cond); + ldap_pvt_thread_cond_wait(&pool->ltp_cond, &pool->ltp_mutex); + } while ((ctx = LDAP_STAILQ_FIRST(&pool->ltp_pending_list)) != NULL) {