From 84315e96f80d593ad8b8363e08d250e3fcccff2b Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Wed, 18 Jan 2006 01:55:24 +0000 Subject: [PATCH] ITS#4349 don't wait on condition if there are no threads in the pool. --- libraries/libldap_r/tpool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) { -- 2.39.5