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

Add a new xShmBarrier method to the VFS - a shared-memory fence operation.

Implement the same in both unix and win32.  Use it to make the WAL subsystem
more robust.

FossilOrigin-Name: 1bd011c9fed5ef29fb616b4d0a52df3b82221b1f
This commit is contained in:
drh
2010-05-20 23:51:06 +00:00
parent 7e263728f2
commit 286a288493
14 changed files with 135 additions and 41 deletions

View File

@@ -103,6 +103,7 @@ static int tvfsShmSize(sqlite3_file*, int , int *);
static int tvfsShmGet(sqlite3_file*, int , int *, volatile void **);
static int tvfsShmRelease(sqlite3_file*);
static int tvfsShmLock(sqlite3_file*, int , int *);
static void tvfsShmBarrier(sqlite3_file*);
static int tvfsShmClose(sqlite3_file*, int);
static sqlite3_io_methods tvfs_io_methods = {
@@ -124,6 +125,7 @@ static sqlite3_io_methods tvfs_io_methods = {
tvfsShmGet, /* xShmGet */
tvfsShmRelease, /* xShmRelease */
tvfsShmLock, /* xShmLock */
tvfsShmBarrier, /* xShmBarrier */
tvfsShmClose /* xShmClose */
};
@@ -269,6 +271,7 @@ static int tvfsOpen(
pMethods->xShmRelease = 0;
pMethods->xShmClose = 0;
pMethods->xShmLock = 0;
pMethods->xShmBarrier = 0;
}
pFile->pMethods = pMethods;
}
@@ -569,6 +572,17 @@ static int tvfsShmLock(
return rc;
}
static void tvfsShmBarrier(sqlite3_file *pFile){
int rc = SQLITE_OK;
TestvfsFile *pFd = (TestvfsFile *)pFile;
Testvfs *p = (Testvfs *)(pFd->pVfs->pAppData);
tvfsExecTcl(p, "xShmBarrier",
Tcl_NewStringObj(pFd->pShm->zFile, -1), pFd->pShmId, 0
);
tvfsResultCode(p, &rc);
}
static int tvfsShmClose(
sqlite3_file *pFile,
int deleteFlag