aboutsummaryrefslogtreecommitdiff
path: root/src/wal.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wal.c')
-rw-r--r--src/wal.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wal.c b/src/wal.c
index 0bdd4adbe..0d1d0e42b 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -1933,6 +1933,7 @@ int sqlite3WalBeginWriteTransaction(Wal *pWal){
if( rc ){
return rc;
}
+ pWal->writeLock = 1;
/* If another connection has written to the database file since the
** time the read transaction on this connection was started, then
@@ -1941,10 +1942,12 @@ int sqlite3WalBeginWriteTransaction(Wal *pWal){
rc = walIndexMap(pWal, pWal->hdr.mxFrame);
if( rc ){
walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);
+ pWal->writeLock = 0;
return rc;
}
if( memcmp(&pWal->hdr, (void*)pWal->pWiData, sizeof(WalIndexHdr))!=0 ){
walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1);
+ pWal->writeLock = 0;
walIndexUnmap(pWal);
return SQLITE_BUSY;
}
@@ -1968,6 +1971,7 @@ int sqlite3WalBeginWriteTransaction(Wal *pWal){
walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1);
}
walUnlockShared(pWal, WAL_READ_LOCK(0));
+ pWal->readLock = -1;
do{
int notUsed;
rc = walTryBeginRead(pWal, &notUsed, 1);