Skip to content
Snippets Groups Projects
Commit 3f20324e authored by Howard Chu's avatar Howard Chu
Browse files

Add ldap_pvt_thread_pool_purgekey to free all instances of key across

all threads.
parent 838421f4
No related branches found
No related tags found
No related merge requests found
......@@ -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 ));
......
......@@ -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<LDAP_MAXTHR; i++ ) {
if ( thread_keys[i].ctx ) {
ctx = thread_keys[i].ctx;
for ( j=0; j<MAXKEYS; j++ ) {
if ( ctx[j].ltk_key == key ) {
if (ctx[j].ltk_free)
ctx[j].ltk_free( ctx[j].ltk_key, ctx[j].ltk_data );
ctx[j].ltk_key = NULL;
ctx[j].ltk_free = NULL;
break;
}
}
}
}
}
/*
* This is necessary if the caller does not have access to the
* thread context handle (for example, a slapd plugin calling
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment