1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Ensure that file-handle winShmNode.hFile.h is used in a thread-safe manner.

FossilOrigin-Name: 7a32b497ab16774021924a8536e1025a0a01740a6484f0de17623a69713511d8
This commit is contained in:
dan
2024-11-25 18:47:12 +00:00
parent 1743c5f836
commit f6d267491c
3 changed files with 12 additions and 7 deletions

View File

@@ -2579,7 +2579,9 @@ static int winLockFileTimeout(
ret = winLockFile(&hFile, flags, offset, 0, nByte, 0);
#else
if( !osIsNT() ){
sqlite3_mutex_enter(pMutex);
ret = winLockFile(&hFile, flags, offset, 0, nByte, 0);
sqlite3_mutex_leave(pMutex);
}else{
OVERLAPPED ovlp;
memset(&ovlp, 0, sizeof(OVERLAPPED));
@@ -2593,7 +2595,10 @@ static int winLockFileTimeout(
flags &= ~LOCKFILE_FAIL_IMMEDIATELY;
}
sqlite3_mutex_enter(pMutex);
ret = osLockFileEx(hFile, flags, 0, nByte, 0, &ovlp);
sqlite3_mutex_leave(pMutex);
if( !ret && nMs>0 && GetLastError()==ERROR_IO_PENDING ){
DWORD res = WaitForSingleObject(ovlp.hEvent, (DWORD)nMs);
if( res==WAIT_OBJECT_0 ){