ID id;
int refcnt, freeit = 1;
- /* set cache mutex */
+ /* set cache write lock */
ldap_pvt_thread_rdwr_wlock( &cache->c_rwlock );
assert( e->e_private );
* for instance)
*/
if ( BEI(e)->bei_state == CACHE_ENTRY_CREATING ) {
+ /* set lru mutex */
ldap_pvt_thread_mutex_lock( &cache->lru_mutex );
bdb_cache_delete_entry_internal( cache, e );
+ /* free lru mutex */
ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
freeit = 0;
/* now the entry is in DELETED state */
if ( BEI(e)->bei_state == CACHE_ENTRY_COMMITTED ) {
BEI(e)->bei_state = CACHE_ENTRY_READY;
- /* free cache mutex */
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
} else if ( BEI(e)->bei_state == CACHE_ENTRY_DELETED ) {
if( refcnt > 0 ) {
- /* free cache mutex */
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
bdb_entry_return( e );
}
- /* free cache mutex */
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
}
} else {
- /* free cache mutex */
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
"bdb_cache_add_entry_rw: add (%s):%s to cache\n",
e->e_dn, rw ? "w" : "r" ));
#endif
- /* set cache mutex */
+ /* set cache write lock */
ldap_pvt_thread_rdwr_wlock( &cache->c_rwlock );
assert( e->e_private == NULL );
if( bdb_cache_entry_private_init(e) != 0 ) {
- /* free cache mutex */
- ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
+ /* free cache write lock */
+ ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
LDAP_LOG(( "cache", LDAP_LEVEL_ERR,
if ( avl_insert( &cache->c_dntree, (caddr_t) e,
(AVL_CMP) entry_dn_cmp, avl_dup_error ) != 0 )
{
- /* free cache mutex */
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
bdb_cache_entry_private_destroy(e);
- /* free cache mutex */
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
return( -1 );
}
BEI(e)->bei_state = CACHE_ENTRY_CREATING;
BEI(e)->bei_refcnt = 1;
+ /* set lru mutex */
ldap_pvt_thread_mutex_lock( &cache->lru_mutex );
/* lru */
LRU_ADD( cache, e );
}
}
- /* free cache mutex */
+ /* free lru mutex */
ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
return( 0 );
}
int i, rc;
Entry *ee;
- /* set cache mutex */
+ /* set cache write lock */
ldap_pvt_thread_rdwr_wlock( &cache->c_rwlock );
assert( e->e_private );
e->e_id, e->e_dn, 0 );
#endif
- /* free cache mutex */
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
return( 1 );
}
#endif
}
- /* free cache mutex */
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
return( -1 );
}
/* will be marked after when entry is returned */
BEI(e)->bei_state = CACHE_ENTRY_CREATING;
+ /* set lru mutex */
ldap_pvt_thread_mutex_lock( &cache->lru_mutex );
/* lru */
LRU_ADD( cache, e );
}
}
- /* free cache mutex */
+ /* free lru mutex */
ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
return( 0 );
}
e.e_nname = *ndn;
try_again:
- /* set cache mutex */
+ /* set cache read lock */
ldap_pvt_thread_rdwr_rlock( &cache->c_rwlock );
if ( (ep = (Entry *) avl_find( cache->c_dntree, (caddr_t) &e,
if ( state != CACHE_ENTRY_READY ) {
assert(state != CACHE_ENTRY_UNDEFINED);
- /* free cache mutex */
+ /* free cache read lock */
ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
goto try_again;
}
+ /* free cache read lock */
ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
+ /* set lru mutex */
ldap_pvt_thread_mutex_lock( &cache->lru_mutex );
/* lru */
LRU_DELETE( cache, ep );
LRU_ADD( cache, ep );
- /* free cache mutex */
+ /* free lru mutex */
ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
#ifdef NEW_LOGGING
#endif
} else {
- /* free cache mutex */
+ /* free cache read lock */
ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
id = NOID;
e.e_id = id;
try_again:
- /* set cache mutex */
+ /* set cache read lock */
ldap_pvt_thread_rdwr_rlock( &cache->c_rwlock );
if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e,
assert(state != CACHE_ENTRY_UNDEFINED);
- /* free cache mutex */
+ /* free cache read lock */
ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
* so, unlock the cache, yield, and try again.
*/
- /* free cache mutex */
+ /* free cache read lock */
ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
#ifdef NEW_LOGGING
goto try_again;
}
+ /* free cache read lock */
ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
+ /* set lru mutex */
ldap_pvt_thread_mutex_lock( &cache->lru_mutex );
/* lru */
LRU_DELETE( cache, ep );
BEI(ep)->bei_refcnt++;
- /* free cache mutex */
+ /* free lru mutex */
ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
#ifdef NEW_LOGGING
return( ep );
}
- /* free cache mutex */
+ /* free cache read lock */
ldap_pvt_thread_rdwr_runlock( &cache->c_rwlock );
return( NULL );
{
int rc;
- /* set cache mutex */
+ /* set cache write lock */
ldap_pvt_thread_rdwr_wlock( &cache->c_rwlock );
assert( e->e_private );
e->e_id, 0, 0 );
#endif
+ /* set lru mutex */
ldap_pvt_thread_mutex_lock( &cache->lru_mutex );
rc = bdb_cache_delete_entry_internal( cache, e );
+ /* free lru mutex */
ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
- /* free cache mutex */
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
return( rc );
}
Entry *e;
int rc;
- /* set cache mutex */
+ /* set cache write lock */
ldap_pvt_thread_rdwr_wlock( &cache->c_rwlock );
+ /* set lru mutex */
ldap_pvt_thread_mutex_lock( &cache->lru_mutex );
#ifdef NEW_LOGGING
}
- /* free cache mutex */
+ /* free lru mutex */
ldap_pvt_thread_mutex_unlock( &cache->lru_mutex );
+ /* free cache write lock */
ldap_pvt_thread_rdwr_wunlock( &cache->c_rwlock );
}