]> git.sur5r.net Git - openldap/commitdiff
Put cond_signal loop inside of mutex'ed area to fix race bug (seen on
authorMark Valence <mrv@openldap.org>
Sun, 18 Jun 2000 05:56:17 +0000 (05:56 +0000)
committerMark Valence <mrv@openldap.org>
Sun, 18 Jun 2000 05:56:17 +0000 (05:56 +0000)
Digital OSF 4.0e on an Alpha?)

libraries/libldap_r/tpool.c

index af0c4f739d63069105f6118fd9cc70fe59f8bef9..d65dc0eeb9ad6eeb6d1c09f379174405be8bd049 100644 (file)
@@ -257,7 +257,6 @@ ldap_pvt_thread_pool_destroy ( ldap_pvt_thread_pool_t *tpool, int run_pending )
                ? LDAP_INT_THREAD_POOL_FINISHING
                : LDAP_INT_THREAD_POOL_STOPPING;
        waiting = pool->ltp_open_count;
-       ldap_pvt_thread_mutex_unlock(&pool->ltp_mutex);
 
        /* broadcast could be used here, but only after
         * it is fixed in the NT thread implementation
@@ -265,6 +264,7 @@ ldap_pvt_thread_pool_destroy ( ldap_pvt_thread_pool_t *tpool, int run_pending )
        while (--waiting >= 0) {
                ldap_pvt_thread_cond_signal(&pool->ltp_cond);
        }
+       ldap_pvt_thread_mutex_unlock(&pool->ltp_mutex);
 
        do {
                ldap_pvt_thread_yield();