From c034282b148c99beb69fda226d59742a48932a2a Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 21 Aug 2015 21:19:16 +0100 Subject: [PATCH] More for threadqueues Catch threads that are finishing while pool was pausing --- libraries/libldap_r/tpool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/libldap_r/tpool.c b/libraries/libldap_r/tpool.c index a7ce7cd059..0759f0416d 100644 --- a/libraries/libldap_r/tpool.c +++ b/libraries/libldap_r/tpool.c @@ -971,7 +971,10 @@ ldap_int_thread_pool_wrapper ( thread_keys[keyslot].ctx = DELETED_THREAD_CTX; ldap_pvt_thread_mutex_unlock(&ldap_pvt_thread_pool_mutex); - pq->ltp_open_count--; + if (pq->ltp_open_count < 0) + pq->ltp_open_count++; + else + pq->ltp_open_count--; if (pq->ltp_open_count == 0) { if (pool->ltp_finishing) /* let pool_destroy know we're all done */ -- 2.39.2