Simplify the way the pager layer invokes the busy-handler callback. (CVS 5922)
FossilOrigin-Name: 7bd1ac189906d87ed360875551d50147dd2186f6
This commit is contained in:
parent
62c14b3487
commit
1ceedd3736
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Changes\sto\savoid\s"unused\sparameter"\scompiler\swarnings.\s(CVS\s5921)
|
||||
D 2008-11-19T09:05:27
|
||||
C Simplify\sthe\sway\sthe\spager\slayer\sinvokes\sthe\sbusy-handler\scallback.\s(CVS\s5922)
|
||||
D 2008-11-19T10:22:33
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in 0aa7bbe3be6acc4045706e3bb3fd0b8f38f4a3b5
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -100,9 +100,9 @@ F src/attach.c 85c6a3d0daf11965b47604190d7cf5597dc88382
|
||||
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
|
||||
F src/bitvec.c 9e922b2577b7e46d8f95349bca6a52f7674d7582
|
||||
F src/btmutex.c 63c5cc4ad5715690767ffcb741e185d7bc35ec1a
|
||||
F src/btree.c abbd6838ba2330d2559cdbbca34887ab8a691bde
|
||||
F src/btree.c 76c1b09263b6f028b4f84bd6d811e9d017448216
|
||||
F src/btree.h 179c3ea813780df78a289a8f5130db18e6d4616e
|
||||
F src/btreeInt.h f4ed02e58381190d5303edb83cff2cc997ba2fa2
|
||||
F src/btreeInt.h 8d21590c97b6a2c00cce1f78ed5dc5756e835108
|
||||
F src/build.c a89e901ea24d8ec845286f9a1fbfd14572a7777e
|
||||
F src/callback.c e970e5beddbdb23f89a6d05cb1a6419d9f755624
|
||||
F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c
|
||||
@ -139,8 +139,8 @@ F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
|
||||
F src/os_os2.c d12285d66df674c42f6f544a6f7c21bf1a954ee1
|
||||
F src/os_unix.c a5f8a41b471196b5cf4c76b28fa8ad7ba4124264
|
||||
F src/os_win.c 08d0b059ac01f32e8813bb96fc573486592b83f5
|
||||
F src/pager.c d328fcea0bfb3abbc174dba6e6b1ca7c0e1ed7ba
|
||||
F src/pager.h 4a57b219c0765fe1870238064e3f46e4eb2cf5af
|
||||
F src/pager.c ae5da38b6415bdd88e56a2a484f29282c4ea09f5
|
||||
F src/pager.h a02ef8e6cc7e78b54874166e5ce786c9d4c489bf
|
||||
F src/parse.y 2c4758b4c5ead6de8cf7112f5a7cce7561d313fe
|
||||
F src/pcache.c 439bcf164f10dd0595cbd63f7472881d46dcbb61
|
||||
F src/pcache.h b6feb183dea39ede8336bb47c5969403d26fa5c0
|
||||
@ -659,7 +659,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
P 16f1e6ec2ad92f68c0079a0c2b5ca08a3b4af816
|
||||
R 647cc31f7b95c8653e9b9ac16a777558
|
||||
P 88134322c36b41304aaeef99c39b4ef5b495ca3b
|
||||
R f6c609c9470d7bd5817e723ffc3958c6
|
||||
U danielk1977
|
||||
Z f14e92edbc704c5d9dbaca32e49b5ee7
|
||||
Z 2226cb5d34a08c82f0375521adf91b01
|
||||
|
@ -1 +1 @@
|
||||
88134322c36b41304aaeef99c39b4ef5b495ca3b
|
||||
7bd1ac189906d87ed360875551d50147dd2186f6
|
10
src/btree.c
10
src/btree.c
@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btree.c,v 1.538 2008/11/19 09:05:27 danielk1977 Exp $
|
||||
** $Id: btree.c,v 1.539 2008/11/19 10:22:33 danielk1977 Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** See the header comment on "btreeInt.h" for additional information.
|
||||
@ -1207,7 +1207,7 @@ static void pageReinit(DbPage *pData){
|
||||
/*
|
||||
** Invoke the busy handler for a btree.
|
||||
*/
|
||||
static int sqlite3BtreeInvokeBusyHandler(void *pArg, int n){
|
||||
static int btreeInvokeBusyHandler(void *pArg){
|
||||
BtShared *pBt = (BtShared*)pArg;
|
||||
assert( pBt->db );
|
||||
assert( sqlite3_mutex_held(pBt->db->mutex) );
|
||||
@ -1324,8 +1324,6 @@ int sqlite3BtreeOpen(
|
||||
rc = SQLITE_NOMEM;
|
||||
goto btree_open_out;
|
||||
}
|
||||
pBt->busyHdr.xFunc = sqlite3BtreeInvokeBusyHandler;
|
||||
pBt->busyHdr.pArg = pBt;
|
||||
rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,
|
||||
EXTRA_SIZE, flags, vfsFlags);
|
||||
if( rc==SQLITE_OK ){
|
||||
@ -1334,7 +1332,7 @@ int sqlite3BtreeOpen(
|
||||
if( rc!=SQLITE_OK ){
|
||||
goto btree_open_out;
|
||||
}
|
||||
sqlite3PagerSetBusyhandler(pBt->pPager, &pBt->busyHdr);
|
||||
sqlite3PagerSetBusyhandler(pBt->pPager, btreeInvokeBusyHandler, pBt);
|
||||
p->pBt = pBt;
|
||||
|
||||
sqlite3PagerSetReiniter(pBt->pPager, pageReinit);
|
||||
@ -2032,7 +2030,7 @@ int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
|
||||
unlockBtreeIfUnused(pBt);
|
||||
}
|
||||
}while( rc==SQLITE_BUSY && pBt->inTransaction==TRANS_NONE &&
|
||||
sqlite3BtreeInvokeBusyHandler(pBt, 0) );
|
||||
btreeInvokeBusyHandler(pBt) );
|
||||
|
||||
if( rc==SQLITE_OK ){
|
||||
if( p->inTrans==TRANS_NONE ){
|
||||
|
@ -9,7 +9,7 @@
|
||||
** May you share freely, never taking more than you give.
|
||||
**
|
||||
*************************************************************************
|
||||
** $Id: btreeInt.h,v 1.35 2008/11/17 14:20:56 danielk1977 Exp $
|
||||
** $Id: btreeInt.h,v 1.36 2008/11/19 10:22:33 danielk1977 Exp $
|
||||
**
|
||||
** This file implements a external (disk-based) database using BTrees.
|
||||
** For a detailed discussion of BTrees, refer to
|
||||
@ -384,7 +384,6 @@ struct BtShared {
|
||||
void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */
|
||||
void (*xFreeSchema)(void*); /* Destructor for BtShared.pSchema */
|
||||
sqlite3_mutex *mutex; /* Non-recursive mutex required to access this struct */
|
||||
BusyHandler busyHdr; /* The busy handler for this btree */
|
||||
#ifndef SQLITE_OMIT_SHARED_CACHE
|
||||
int nRef; /* Number of references to this structure */
|
||||
BtShared *pNext; /* Next on a list of sharable BtShared structs */
|
||||
|
20
src/pager.c
20
src/pager.c
@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.504 2008/11/17 04:56:24 danielk1977 Exp $
|
||||
** @(#) $Id: pager.c,v 1.505 2008/11/19 10:22:33 danielk1977 Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
#include "sqliteInt.h"
|
||||
@ -198,7 +198,8 @@ struct Pager {
|
||||
char *zDirectory; /* Directory hold database and journal files */
|
||||
sqlite3_file *fd, *jfd; /* File descriptors for database and journal */
|
||||
sqlite3_file *stfd; /* File descriptor for the statement subjournal*/
|
||||
BusyHandler *pBusyHandler; /* Pointer to sqlite.busyHandler */
|
||||
int (*xBusyHandler)(void*); /* Function to call when busy */
|
||||
void *pBusyHandlerArg; /* Context argument for xBusyHandler */
|
||||
i64 journalOff; /* Current byte offset in the journal file */
|
||||
i64 journalHdr; /* Byte offset to previous journal header */
|
||||
i64 stmtHdrOff; /* First journal header written this statement */
|
||||
@ -1942,7 +1943,8 @@ int sqlite3PagerOpen(
|
||||
if( memDb ){
|
||||
pPager->journalMode = PAGER_JOURNALMODE_MEMORY;
|
||||
}
|
||||
/* pPager->pBusyHandler = 0; */
|
||||
/* pPager->xBusyHandler = 0; */
|
||||
/* pPager->pBusyHandlerArg = 0; */
|
||||
/* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
|
||||
*ppPager = pPager;
|
||||
return SQLITE_OK;
|
||||
@ -1951,8 +1953,13 @@ int sqlite3PagerOpen(
|
||||
/*
|
||||
** Set the busy handler function.
|
||||
*/
|
||||
void sqlite3PagerSetBusyhandler(Pager *pPager, BusyHandler *pBusyHandler){
|
||||
pPager->pBusyHandler = pBusyHandler;
|
||||
void sqlite3PagerSetBusyhandler(
|
||||
Pager *pPager,
|
||||
int (*xBusyHandler)(void *),
|
||||
void *pBusyHandlerArg
|
||||
){
|
||||
pPager->xBusyHandler = xBusyHandler;
|
||||
pPager->pBusyHandlerArg = pBusyHandlerArg;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2163,10 +2170,9 @@ static int pager_wait_on_lock(Pager *pPager, int locktype){
|
||||
if( pPager->state>=locktype ){
|
||||
rc = SQLITE_OK;
|
||||
}else{
|
||||
if( pPager->pBusyHandler ) pPager->pBusyHandler->nBusy = 0;
|
||||
do {
|
||||
rc = sqlite3OsLock(pPager->fd, locktype);
|
||||
}while( rc==SQLITE_BUSY && sqlite3InvokeBusyHandler(pPager->pBusyHandler) );
|
||||
}while( rc==SQLITE_BUSY && pPager->xBusyHandler(pPager->pBusyHandlerArg) );
|
||||
if( rc==SQLITE_OK ){
|
||||
pPager->state = locktype;
|
||||
IOTRACE(("LOCK %p %d\n", pPager, locktype))
|
||||
|
@ -13,7 +13,7 @@
|
||||
** subsystem. The page cache subsystem reads and writes a file a page
|
||||
** at a time and provides a journal for rollback.
|
||||
**
|
||||
** @(#) $Id: pager.h,v 1.86 2008/10/17 18:51:53 danielk1977 Exp $
|
||||
** @(#) $Id: pager.h,v 1.87 2008/11/19 10:22:33 danielk1977 Exp $
|
||||
*/
|
||||
|
||||
#ifndef _PAGER_H_
|
||||
@ -73,7 +73,7 @@ typedef struct PgHdr DbPage;
|
||||
** routines:
|
||||
*/
|
||||
int sqlite3PagerOpen(sqlite3_vfs *, Pager **ppPager, const char*, int,int,int);
|
||||
void sqlite3PagerSetBusyhandler(Pager*, BusyHandler *pBusyHandler);
|
||||
void sqlite3PagerSetBusyhandler(Pager*, int(*)(void *), void *);
|
||||
void sqlite3PagerSetReiniter(Pager*, void(*)(DbPage*));
|
||||
int sqlite3PagerSetPagesize(Pager*, u16*);
|
||||
int sqlite3PagerMaxPageCount(Pager*, int);
|
||||
|
Loading…
x
Reference in New Issue
Block a user