Debug( LDAP_DEBUG_TRACE, "<= ldbm_cache_open (opened %d)\n", i, 0, 0 );
#endif
+ ldap_pvt_thread_mutex_init( &li->li_dbcache[i].dbc_write_mutex );
+
ldap_pvt_thread_mutex_unlock( &li->li_dbcache_mutex );
return( &li->li_dbcache[i] );
}
ldbm_close( db->dbc_db );
free( db->dbc_name );
db->dbc_name = NULL;
+ ldap_pvt_thread_mutex_destroy( &db->dbc_write_mutex );
}
ldap_pvt_thread_mutex_unlock( &li->li_dbcache_mutex );
}
key.dsize = strlen( pdn ) + 2;
key.dptr = ch_malloc( key.dsize );
sprintf( key.dptr, "%c%s", DN_ONE_PREFIX, pdn );
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
rc = idl_insert_key( be, db, key, id );
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
free( key.dptr );
free( pdn );
}
key.dptr = ch_malloc( key.dsize );
sprintf( key.dptr, "%c%s",
DN_SUBTREE_PREFIX, subtree[i] );
-
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
rc = idl_insert_key( be, db, key, id );
-
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
free( key.dptr );
if(rc == -1) break;
key.dptr = ch_malloc( key.dsize );
sprintf( key.dptr, "%c%s", DN_ONE_PREFIX, pdn );
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
(void) idl_delete_key( be, db, key, id );
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
free( key.dptr );
free( pdn );
sprintf( key.dptr, "%c%s",
DN_SUBTREE_PREFIX, subtree[i] );
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
(void) idl_delete_key( be, db, key, id );
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
free( key.dptr );
}
key.dptr = k->bv_val;
key.dsize = k->bv_len;
+ ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
if (op == SLAP_INDEX_ADD_OP) {
/* Add values */
rc = idl_insert_key( be, db, key, id );
/* Delete values */
rc = idl_delete_key( be, db, key, id );
}
+ ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
#ifdef NEW_LOGGING