1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Code simplifications in support of structural testing. (CVS 6900)

FossilOrigin-Name: fb1b955dda5105025ef199880afa871e44331d65
This commit is contained in:
drh
2009-07-17 11:44:07 +00:00
parent e64ca7ba11
commit f18a61dd59
5 changed files with 37 additions and 24 deletions

View File

@@ -10,7 +10,7 @@
**
*************************************************************************
**
** $Id: btmutex.c,v 1.15 2009/04/10 12:55:17 danielk1977 Exp $
** $Id: btmutex.c,v 1.16 2009/07/17 11:44:07 drh Exp $
**
** This file contains code used to implement mutexes on Btree objects.
** This code really belongs in btree.c. But btree.c is getting too
@@ -308,8 +308,12 @@ void sqlite3BtreeMutexArrayEnter(BtreeMutexArray *pArray){
/* We should already hold a lock on the database connection */
assert( sqlite3_mutex_held(p->db->mutex) );
/* The Btree is sharable because only sharable Btrees are entered
** into the array in the first place. */
assert( p->sharable );
p->wantToLock++;
if( !p->locked && p->sharable ){
if( !p->locked ){
lockBtreeMutex(p);
}
}
@@ -324,14 +328,14 @@ void sqlite3BtreeMutexArrayLeave(BtreeMutexArray *pArray){
Btree *p = pArray->aBtree[i];
/* Some basic sanity checking */
assert( i==0 || pArray->aBtree[i-1]->pBt<p->pBt );
assert( p->locked || !p->sharable );
assert( p->locked );
assert( p->wantToLock>0 );
/* We should already hold a lock on the database connection */
assert( sqlite3_mutex_held(p->db->mutex) );
p->wantToLock--;
if( p->wantToLock==0 && p->locked ){
if( p->wantToLock==0 ){
unlockBtreeMutex(p);
}
}