From 3f20324ed0ac192926bf33e1e5679e5f2db753aa Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 22 Apr 2005 22:27:29 +0000 Subject: [PATCH] Add ldap_pvt_thread_pool_purgekey to free all instances of key across all threads. --- include/ldap_pvt_thread.h | 3 +++ libraries/libldap_r/tpool.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/include/ldap_pvt_thread.h b/include/ldap_pvt_thread.h index 6c1b86845b..1ca300bd98 100644 --- a/include/ldap_pvt_thread.h +++ b/include/ldap_pvt_thread.h @@ -202,6 +202,9 @@ ldap_pvt_thread_pool_setkey LDAP_P(( void *data, ldap_pvt_thread_pool_keyfree_t *kfree )); +LDAP_F( void ) +ldap_pvt_thread_pool_purgekey LDAP_P(( void *key )); + LDAP_F( void *) ldap_pvt_thread_pool_context LDAP_P(( void )); diff --git a/libraries/libldap_r/tpool.c b/libraries/libldap_r/tpool.c index 31fa541cb8..50bac8d2c1 100644 --- a/libraries/libldap_r/tpool.c +++ b/libraries/libldap_r/tpool.c @@ -616,6 +616,30 @@ int ldap_pvt_thread_pool_setkey( return ENOMEM; } +/* Free all elements with this key, no matter which thread they're in. + * May only be called while the pool is paused. + */ +void ldap_pvt_thread_pool_purgekey( void *key ) +{ + int i, j; + ldap_int_thread_key_t *ctx; + + for ( i=0; i