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

Make sure there is only one busy counter. Ticket #1315. (CVS 2543)

FossilOrigin-Name: af2a0ba4a38abf208db1ff6f018cf756de2afd5b
This commit is contained in:
drh
2005-07-09 02:16:02 +00:00
parent 57dbd7b324
commit a4afb65cb7
8 changed files with 86 additions and 28 deletions

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.207 2005/06/07 02:12:30 drh Exp $
** @(#) $Id: pager.c,v 1.208 2005/07/09 02:16:03 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -1866,7 +1866,7 @@ static void memoryTruncate(Pager *pPager){
/*
** Try to obtain a lock on a file. Invoke the busy callback if the lock
** is currently not available. Repeate until the busy callback returns
** is currently not available. Repeat until the busy callback returns
** false or until the lock succeeds.
**
** Return SQLITE_OK on success and an error code if we cannot obtain
@@ -1880,14 +1880,9 @@ static int pager_wait_on_lock(Pager *pPager, int locktype){
if( pPager->state>=locktype ){
rc = SQLITE_OK;
}else{
int busy = 1;
BusyHandler *pH;
do {
rc = sqlite3OsLock(&pPager->fd, locktype);
}while( rc==SQLITE_BUSY &&
(pH = pPager->pBusyHandler)!=0 &&
pH->xFunc && pH->xFunc(pH->pArg, busy++)
);
}while( rc==SQLITE_BUSY && sqlite3InvokeBusyHandler(pPager->pBusyHandler) );
if( rc==SQLITE_OK ){
pPager->state = locktype;
}