diff options
author | dan <Dan Kennedy> | 2023-11-15 19:19:04 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2023-11-15 19:19:04 +0000 |
commit | 91c8e65dd4bf17d21fbf8f7073565fe1a71c8948 (patch) | |
tree | beaa93bbdff567e4f857adafa75a4170143883d8 /src/os_unix.c | |
parent | 9eb7694d587b2a8b61c180e0369f10ac23a72973 (diff) | |
parent | 4ffaa7c5dedbc86b5736b139bc0465524ab3db51 (diff) | |
download | sqlite-91c8e65dd4bf17d21fbf8f7073565fe1a71c8948.tar.gz sqlite-91c8e65dd4bf17d21fbf8f7073565fe1a71c8948.zip |
Changes so that if SQLITE_ENABLE_SETLK_TIMEOUT is defined as 2 instead of 1, all blocking locks are taken for a single millisecond and the default busy-handler invoked as normal.
FossilOrigin-Name: 79e24ec3dd40373bbb93792829b18d9ef40daf19d4606174e36c8e19e61a7529
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index cd3e0fc54..3171b41fd 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4054,7 +4054,13 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){ #ifdef SQLITE_ENABLE_SETLK_TIMEOUT case SQLITE_FCNTL_LOCK_TIMEOUT: { int iOld = pFile->iBusyTimeout; +#if SQLITE_ENABLE_SETLK_TIMEOUT==1 pFile->iBusyTimeout = *(int*)pArg; +#elif SQLITE_ENABLE_SETLK_TIMEOUT==2 + pFile->iBusyTimeout = !!(*(int*)pArg); +#else +# error "SQLITE_ENABLE_SETLK_TIMEOUT must be set to 1 or 2" +#endif *(int*)pArg = iOld; return SQLITE_OK; } @@ -4426,7 +4432,7 @@ static int unixShmSystemLock( f.l_len = n; res = osSetPosixAdvisoryLock(pShmNode->hShm, &f, pFile); if( res==-1 ){ -#ifdef SQLITE_ENABLE_SETLK_TIMEOUT +#if defined(SQLITE_ENABLE_SETLK_TIMEOUT) && SQLITE_ENABLE_SETLK_TIMEOUT==1 rc = (pFile->iBusyTimeout ? SQLITE_BUSY_TIMEOUT : SQLITE_BUSY); #else rc = SQLITE_BUSY; |