]> git.sur5r.net Git - openldap/commitdiff
More for threadqueues
authorHoward Chu <hyc@openldap.org>
Fri, 21 Aug 2015 20:19:16 +0000 (21:19 +0100)
committerHoward Chu <hyc@openldap.org>
Fri, 21 Aug 2015 20:37:37 +0000 (21:37 +0100)
Catch threads that are finishing while pool was pausing

libraries/libldap_r/tpool.c

index a7ce7cd05975add7925e0f87d8f28494377fc2d5..0759f0416dc3913d35c6bba8f3b847e53e8963f4 100644 (file)
@@ -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 */