mirror of
https://github.com/sqlite/sqlite.git
synced 2025-12-21 13:38:01 +03:00
Change things 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: ac381e6eb3c9284e65f7aad66d21bee1bca9ef4123684ccaf069b8a6d157a56d
This commit is contained in:
@@ -3997,7 +3997,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;
|
||||
}
|
||||
@@ -4325,7 +4331,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;
|
||||
|
||||
Reference in New Issue
Block a user