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

Revise locking retry semantics in Win32 VFS to abort early if the file handle is reported as invalid.

FossilOrigin-Name: d43e2e59b5647655595fd953febf2beefa480006
This commit is contained in:
mistachkin
2014-05-28 03:27:42 +00:00
parent ff0bc8f9f7
commit 8e86b6a3df
3 changed files with 18 additions and 7 deletions

View File

@@ -2924,8 +2924,16 @@ static int winLock(sqlite3_file *id, int locktype){
** If you are using this code as a model for alternative VFSes, do not
** copy this retry logic. It is a hack intended for Windows only.
*/
lastErrno = osGetLastError();
OSTRACE(("LOCK-PENDING-FAIL file=%p, count=%d, result=%d\n",
pFile->h, cnt, res));
if( lastErrno==ERROR_INVALID_HANDLE ){
pFile->lastErrno = lastErrno;
rc = SQLITE_IOERR_LOCK;
OSTRACE(("LOCK-FAIL file=%p, count=%d, rc=%s\n",
pFile->h, cnt, sqlite3ErrName(rc)));
return rc;
}
if( cnt ) sqlite3_win32_sleep(1);
}
gotPendingLock = res;