mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-19 05:13:35 -05:00
Add ldap_pvt_thread_pool_purgekey to free all instances of key across
all threads.
This commit is contained in:
parent
838421f416
commit
3f20324ed0
2 changed files with 27 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue