1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-09 14:21:03 +03:00

Drop the mutex on the multiplexor before entering the xRead VFS call.

FossilOrigin-Name: a00d2ed49c9f53263cd76ad41dad9e35e646ebb5
This commit is contained in:
drh
2013-10-21 13:15:55 +00:00
parent 05684271c6
commit ee68ccfbad
3 changed files with 17 additions and 9 deletions

View File

@@ -755,9 +755,11 @@ static int multiplexRead(
multiplexConn *p = (multiplexConn*)pConn;
multiplexGroup *pGroup = p->pGroup;
int rc = SQLITE_OK;
multiplexEnter();
int nMutex = 0;
multiplexEnter(); nMutex++;
if( !pGroup->bEnabled ){
sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, 0, &rc, NULL, 0);
multiplexLeave(); nMutex--;
if( pSubOpen==0 ){
rc = SQLITE_IOERR_READ;
}else{
@@ -766,7 +768,9 @@ static int multiplexRead(
}else{
while( iAmt > 0 ){
int i = (int)(iOfst / pGroup->szChunk);
if( nMutex==0 ){ multiplexEnter(); nMutex++; }
sqlite3_file *pSubOpen = multiplexSubOpen(pGroup, i, &rc, NULL, 1);
multiplexLeave(); nMutex--;
if( pSubOpen ){
int extra = ((int)(iOfst % pGroup->szChunk) + iAmt) - pGroup->szChunk;
if( extra<0 ) extra = 0;
@@ -783,7 +787,8 @@ static int multiplexRead(
}
}
}
multiplexLeave();
assert( nMutex==0 || nMutex==1 );
if( nMutex ) multiplexLeave();
return rc;
}