]> git.sur5r.net Git - openldap/commitdiff
ITS#3796 fix IDL cache lock setup/teardown
authorHoward Chu <hyc@openldap.org>
Tue, 28 Jun 2005 00:43:41 +0000 (00:43 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 28 Jun 2005 00:43:41 +0000 (00:43 +0000)
servers/slapd/back-bdb/init.c

index b63961f027b19353fdea6fb262178d1094685edd..d8fea3b380f99f4532d2efedc574b1c407d16843 100644 (file)
@@ -69,6 +69,8 @@ bdb_db_init( BackendDB *be )
        ldap_pvt_thread_mutex_init( &bdb->bi_cache.lru_mutex );
        ldap_pvt_thread_mutex_init( &bdb->bi_cache.c_dntree.bei_kids_mutex );
        ldap_pvt_thread_rdwr_init ( &bdb->bi_cache.c_rwlock );
+       ldap_pvt_thread_rdwr_init( &bdb->bi_idl_tree_rwlock );
+       ldap_pvt_thread_mutex_init( &bdb->bi_idl_tree_lrulock );
 
        be->be_private = bdb;
        be->be_cf_ocs = be->bd_info->bi_cf_ocs;
@@ -385,8 +387,6 @@ bdb_db_open( BackendDB *be )
 
        if ( bdb->bi_idl_cache_max_size ) {
                bdb->bi_idl_tree = NULL;
-               ldap_pvt_thread_rdwr_init( &bdb->bi_idl_tree_rwlock );
-               ldap_pvt_thread_mutex_init( &bdb->bi_idl_tree_lrulock );
                bdb->bi_idl_cache_size = 0;
        }
 
@@ -630,10 +630,8 @@ bdb_db_destroy( BackendDB *be )
        ldap_pvt_thread_mutex_destroy( &bdb->bi_cache.c_dntree.bei_kids_mutex );
        ldap_pvt_thread_mutex_destroy( &bdb->bi_lastid_mutex );
        ldap_pvt_thread_mutex_destroy( &bdb->bi_database_mutex );
-       if ( bdb->bi_idl_cache_max_size ) {
-               ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock );
-               ldap_pvt_thread_mutex_destroy( &bdb->bi_idl_tree_lrulock );
-       }
+       ldap_pvt_thread_rdwr_destroy( &bdb->bi_idl_tree_rwlock );
+       ldap_pvt_thread_mutex_destroy( &bdb->bi_idl_tree_lrulock );
 
        ch_free( bdb );
        be->be_private = NULL;