Free main-thread keys in db_close, can't do it later because the env

will be gone.
This commit is contained in:
Howard Chu 2007-01-25 12:00:40 +00:00
parent 8d03970944
commit ea8a2894c4
2 changed files with 16 additions and 1 deletions

View file

@ -1371,6 +1371,19 @@ bdb_locker_id_free( void *key, void *data )
}
}
/* free up any keys used by the main thread */
void
bdb_locker_flush( DB_ENV *env )
{
void *data;
void *ctx = ldap_pvt_thread_pool_context();
if ( !ldap_pvt_thread_pool_getkey( ctx, env, &data, NULL ) ) {
ldap_pvt_thread_pool_setkey( ctx, env, NULL, NULL );
bdb_locker_id_free( env, data );
}
}
int
bdb_locker_id( Operation *op, DB_ENV *env, u_int32_t *locker )
{

View file

@ -494,7 +494,9 @@ bdb_db_close( BackendDB *be )
XLOCK_ID_FREE(bdb->bi_dbenv, bdb->bi_cache.c_locker);
bdb->bi_cache.c_locker = 0;
}
#ifdef BDB_REUSE_LOCKERS
bdb_locker_flush( bdb->bi_dbenv );
#endif
/* force a checkpoint, but not if we were ReadOnly,
* and not in Quick mode since there are no transactions there.
*/