aboutsummaryrefslogtreecommitdiff
path: root/src/test_osinst.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-05-20 23:51:06 +0000
committerdrh <drh@noemail.net>2010-05-20 23:51:06 +0000
commit286a28849332e8e32e711fe4fd0c49936978a839 (patch)
treea29adbe424bbeaa857181ce2df1a5fde7ecab940 /src/test_osinst.c
parent7e263728f2af62e2eca639c1a7bd0e2985295c10 (diff)
downloadsqlite-286a28849332e8e32e711fe4fd0c49936978a839.tar.gz
sqlite-286a28849332e8e32e711fe4fd0c49936978a839.zip
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
Diffstat (limited to 'src/test_osinst.c')
-rw-r--r--src/test_osinst.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/test_osinst.c b/src/test_osinst.c
index 0c8d311e3..f5e541c2d 100644
--- a/src/test_osinst.c
+++ b/src/test_osinst.c
@@ -98,10 +98,11 @@
#define OS_SHMGET 23
#define OS_SHMRELEASE 24
#define OS_SHMLOCK 25
-#define OS_SHMSIZE 26
-#define OS_ANNOTATE 27
+#define OS_SHMBARRIER 26
+#define OS_SHMSIZE 27
+#define OS_ANNOTATE 28
-#define OS_NUMEVENTS 28
+#define OS_NUMEVENTS 29
#define VFSLOG_BUFFERSIZE 8192
@@ -150,6 +151,7 @@ static int vfslogShmSize(sqlite3_file *pFile, int reqSize, int *pNewSize);
static int vfslogShmGet(sqlite3_file *pFile, int,int*,volatile void **);
static int vfslogShmRelease(sqlite3_file *pFile);
static int vfslogShmLock(sqlite3_file *pFile, int desiredLock, int *gotLock);
+static void vfslogShmBarrier(sqlite3_file*);
static int vfslogShmClose(sqlite3_file *pFile, int deleteFlag);
/*
@@ -206,6 +208,7 @@ static sqlite3_io_methods vfslog_io_methods = {
vfslogShmGet, /* xShmGet */
vfslogShmRelease, /* xShmRelease */
vfslogShmLock, /* xShmLock */
+ vfslogShmBarrier, /* xShmBarrier */
vfslogShmClose /* xShmClose */
};
@@ -455,6 +458,14 @@ static int vfslogShmLock(sqlite3_file *pFile, int desiredLock, int *gotLock){
vfslog_call(p->pVfslog, OS_SHMLOCK, p->iFileId, t, rc, 0, 0);
return rc;
}
+static void vfslogShmBarrier(sqlite3_file *pFile){
+ sqlite3_uint64 t;
+ VfslogFile *p = (VfslogFile *)pFile;
+ t = vfslog_time();
+ p->pReal->pMethods->xShmBarrier(p->pReal);
+ t = vfslog_time() - t;
+ vfslog_call(p->pVfslog, OS_SHMBARRIER, p->iFileId, t, SQLITE_OK, 0, 0);
+}
static int vfslogShmClose(sqlite3_file *pFile, int deleteFlag){
int rc;
sqlite3_uint64 t;
@@ -781,6 +792,7 @@ static const char *vfslog_eventname(int eEvent){
case OS_SHMSIZE: zEvent = "xShmSize"; break;
case OS_SHMRELEASE: zEvent = "xShmRelease"; break;
case OS_SHMLOCK: zEvent = "xShmLock"; break;
+ case OS_SHMBARRIER: zEvent = "xShmBarrier"; break;
case OS_ANNOTATE: zEvent = "annotation"; break;
}