X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap_r%2Ftpool.c;h=923a1b9ce4e23c94e543c87b1e8fab17288e8744;hb=319440033f01e6939de0ec70689cd9325d7bcdee;hp=fa159b3df0421b4653cf9df6e25ff2186944f8aa;hpb=029306a5bebdcfec1de9c85c1c5e72b276f3fac7;p=openldap diff --git a/libraries/libldap_r/tpool.c b/libraries/libldap_r/tpool.c index fa159b3df0..923a1b9ce4 100644 --- a/libraries/libldap_r/tpool.c +++ b/libraries/libldap_r/tpool.c @@ -1,6 +1,6 @@ /* $OpenLDAP$ */ /* - * Copyright 1998-2000 The OpenLDAP Foundation, Redwood City, California, USA + * Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA * All rights reserved. * * Redistribution and use in source and binary forms are permitted only @@ -60,8 +60,7 @@ static LDAP_STAILQ_HEAD(tpq, ldap_int_thread_pool_s) static ldap_pvt_thread_mutex_t ldap_pvt_thread_pool_mutex; -static void *ldap_int_thread_pool_wrapper( - struct ldap_int_thread_pool_s *pool ); +static void *ldap_int_thread_pool_wrapper( void *pool ); int ldap_int_thread_pool_startup ( void ) @@ -130,8 +129,7 @@ ldap_pvt_thread_pool_init ( pool->ltp_open_count++; ldap_pvt_thread_t thr; - rc = ldap_pvt_thread_create( &thr, 1, - (void *) ldap_int_thread_pool_wrapper, pool ); + rc = ldap_pvt_thread_create( &thr, 1, ldap_int_thread_pool_wrapper, pool ); if( rc != 0) { /* couldn't start one? then don't start any */ @@ -141,7 +139,7 @@ ldap_pvt_thread_pool_init ( ldap_pvt_thread_mutex_unlock(&ldap_pvt_thread_pool_mutex); ldap_pvt_thread_cond_destroy(&pool->ltp_cond); ldap_pvt_thread_mutex_destroy(&pool->ltp_mutex); - free(pool); + LDAP_FREE(pool); return(-1); } #endif @@ -208,7 +206,7 @@ ldap_pvt_thread_pool_submit ( if (need_thread) { int rc = ldap_pvt_thread_create( &thr, 1, - (void *)ldap_int_thread_pool_wrapper, pool ); + ldap_int_thread_pool_wrapper, pool ); ldap_pvt_thread_mutex_lock(&pool->ltp_mutex); if (rc == 0) { pool->ltp_starting--; @@ -233,7 +231,7 @@ ldap_pvt_thread_pool_submit ( ldap_int_thread_ctx_s, ltc_next.q); pool->ltp_pending_count++; ldap_pvt_thread_mutex_unlock(&pool->ltp_mutex); - free(ctx); + LDAP_FREE(ctx); return(-1); } } @@ -336,25 +334,26 @@ ldap_pvt_thread_pool_destroy ( ldap_pvt_thread_pool_t *tpool, int run_pending ) while ((ctx = LDAP_STAILQ_FIRST(&pool->ltp_pending_list)) != NULL) { LDAP_STAILQ_REMOVE_HEAD(&pool->ltp_pending_list, ltc_next.q); - free(ctx); + LDAP_FREE(ctx); } while ((ctx = LDAP_SLIST_FIRST(&pool->ltp_free_list)) != NULL) { LDAP_SLIST_REMOVE_HEAD(&pool->ltp_free_list, ltc_next.l); - free(ctx); + LDAP_FREE(ctx); } ldap_pvt_thread_cond_destroy(&pool->ltp_cond); ldap_pvt_thread_mutex_destroy(&pool->ltp_mutex); - free(pool); + LDAP_FREE(pool); return(0); } static void * ldap_int_thread_pool_wrapper ( - struct ldap_int_thread_pool_s *pool ) + void *xpool ) { + struct ldap_int_thread_pool_s *pool = xpool; ldap_int_thread_ctx_t *ctx; if (pool == NULL)