aboutsummaryrefslogtreecommitdiff
path: root/src/btmutex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/btmutex.c')
-rw-r--r--src/btmutex.c31
1 files changed, 3 insertions, 28 deletions
diff --git a/src/btmutex.c b/src/btmutex.c
index 1de9db07e..ffe124fdd 100644
--- a/src/btmutex.c
+++ b/src/btmutex.c
@@ -186,30 +186,11 @@ void sqlite3BtreeLeaveCursor(BtCursor *pCur){
*/
void sqlite3BtreeEnterAll(sqlite3 *db){
int i;
- Btree *p, *pLater;
+ Btree *p;
assert( sqlite3_mutex_held(db->mutex) );
for(i=0; i<db->nDb; i++){
p = db->aDb[i].pBt;
- assert( !p || (p->locked==0 && p->sharable) || p->pBt->db==p->db );
- if( p && p->sharable ){
- p->wantToLock++;
- if( !p->locked ){
- assert( p->wantToLock==1 );
- while( p->pPrev ) p = p->pPrev;
- /* Reason for ALWAYS: There must be at least one unlocked Btree in
- ** the chain. Otherwise the !p->locked test above would have failed */
- while( p->locked && ALWAYS(p->pNext) ) p = p->pNext;
- for(pLater = p->pNext; pLater; pLater=pLater->pNext){
- if( pLater->locked ){
- unlockBtreeMutex(pLater);
- }
- }
- while( p ){
- lockBtreeMutex(p);
- p = p->pNext;
- }
- }
- }
+ if( p ) sqlite3BtreeEnter(p);
}
}
void sqlite3BtreeLeaveAll(sqlite3 *db){
@@ -218,13 +199,7 @@ void sqlite3BtreeLeaveAll(sqlite3 *db){
assert( sqlite3_mutex_held(db->mutex) );
for(i=0; i<db->nDb; i++){
p = db->aDb[i].pBt;
- if( p && p->sharable ){
- assert( p->wantToLock>0 );
- p->wantToLock--;
- if( p->wantToLock==0 ){
- unlockBtreeMutex(p);
- }
- }
+ if( p ) sqlite3BtreeLeave(p);
}
}