From: Pierangelo Masarati Date: Thu, 1 Sep 2005 01:54:00 +0000 (+0000) Subject: wait also if PAUSING; silence warnings and improve readability with gdb X-Git-Tag: OPENLDAP_REL_ENG_2_2_MP~517 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fe4b006e17b0a0a69e52de694b6636b26485a53c;p=openldap wait also if PAUSING; silence warnings and improve readability with gdb --- diff --git a/libraries/libldap_r/tpool.c b/libraries/libldap_r/tpool.c index 440b5a75e5..a4196c59fd 100644 --- a/libraries/libldap_r/tpool.c +++ b/libraries/libldap_r/tpool.c @@ -29,12 +29,12 @@ #ifndef LDAP_THREAD_HAVE_TPOOL -enum ldap_int_thread_pool_state { +typedef enum ldap_int_thread_pool_state_e { LDAP_INT_THREAD_POOL_RUNNING, LDAP_INT_THREAD_POOL_FINISHING, LDAP_INT_THREAD_POOL_STOPPING, LDAP_INT_THREAD_POOL_PAUSING -}; +} ldap_int_thread_pool_state_t; typedef struct ldap_int_thread_key_s { void *ltk_key; @@ -79,7 +79,7 @@ struct ldap_int_thread_pool_s { LDAP_STAILQ_HEAD(tcq, ldap_int_thread_ctx_s) ltp_pending_list; LDAP_SLIST_HEAD(tcl, ldap_int_thread_ctx_s) ltp_free_list; LDAP_SLIST_HEAD(tclq, ldap_int_thread_ctx_s) ltp_active_list; - long ltp_state; + ldap_int_thread_pool_state_t ltp_state; long ltp_max_count; long ltp_max_pending; long ltp_pending_count; @@ -193,7 +193,7 @@ ldap_pvt_thread_pool_init ( return(0); } -#define TID_HASH(tid, hash) do { int i; \ +#define TID_HASH(tid, hash) do { unsigned i; \ unsigned char *ptr = (unsigned char *)&(tid); \ for (i=0, hash=0; iltp_state == LDAP_INT_THREAD_POOL_RUNNING) + if (pool->ltp_state == LDAP_INT_THREAD_POOL_RUNNING + || pool->ltp_state == LDAP_INT_THREAD_POOL_PAUSING) + { ldap_pvt_thread_cond_wait(&pool->ltp_cond, &pool->ltp_mutex); + } continue; }