1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-12-03 08:01:19 +03:00

Work around restriction in Windows file locking.

FossilOrigin-Name: fe441df9ba447d97571e919099846efa3ec87427
This commit is contained in:
shaneh
2010-12-07 17:12:21 +00:00
parent c216eee7ce
commit 2c2e8eb1a8
5 changed files with 16 additions and 12 deletions

View File

@@ -151,10 +151,14 @@ static int superlockWalLock(
void sqlite3demo_superunlock(void *pLock){
Superlock *p = (Superlock *)pLock;
if( p->bWal ){
int rc; /* Return code */
int flags = SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE;
sqlite3_file *fd = 0;
sqlite3_file_control(p->db, "main", SQLITE_FCNTL_FILE_POINTER, (void *)&fd);
fd->pMethods->xShmLock(fd, 2, SQLITE_SHM_NLOCK-2, flags);
rc = sqlite3_file_control(p->db, "main", SQLITE_FCNTL_FILE_POINTER, (void *)&fd);
if( rc==SQLITE_OK ){
fd->pMethods->xShmLock(fd, 2, 1, flags);
fd->pMethods->xShmLock(fd, 3, SQLITE_SHM_NLOCK-3, flags);
}
}
sqlite3_close(p->db);
sqlite3_free(p);