]> git.sur5r.net Git - openldap/commitdiff
ITS#4349 don't wait on condition if there are no threads in the pool.
authorHoward Chu <hyc@openldap.org>
Wed, 18 Jan 2006 01:55:24 +0000 (01:55 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 18 Jan 2006 01:55:24 +0000 (01:55 +0000)
libraries/libldap_r/tpool.c

index 56e8f546878e635be19c9ae4dfc11c4f7051c60b..21d98d64650851c3921246783eb5fc700c6af76c 100644 (file)
@@ -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)
        {