mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Recursive mutexes in os_win.c. (CVS 2969)
FossilOrigin-Name: dd3e07cae4d0cbd4f8977e1dd11e0103e0e45b75
This commit is contained in:
11
src/os_win.c
11
src/os_win.c
@@ -1068,6 +1068,7 @@ int sqlite3WinSleep(int ms){
|
||||
*/
|
||||
static int inMutex = 0;
|
||||
#ifdef SQLITE_W32_THREADS
|
||||
static HANDLE mutexOwner;
|
||||
static CRITICAL_SECTION cs;
|
||||
#endif
|
||||
|
||||
@@ -1092,13 +1093,13 @@ void sqlite3WinEnterMutex(){
|
||||
}
|
||||
}
|
||||
EnterCriticalSection(&cs);
|
||||
mutexOwner = GetCurrentThread();
|
||||
#endif
|
||||
assert( !inMutex );
|
||||
inMutex = 1;
|
||||
inMutex++;
|
||||
}
|
||||
void sqlite3WinLeaveMutex(){
|
||||
assert( inMutex );
|
||||
inMutex = 0;
|
||||
inMutex--;
|
||||
#ifdef SQLITE_W32_THREADS
|
||||
LeaveCriticalSection(&cs);
|
||||
#endif
|
||||
@@ -1108,7 +1109,11 @@ void sqlite3WinLeaveMutex(){
|
||||
** Return TRUE if we are currently within the mutex and FALSE if not.
|
||||
*/
|
||||
int sqlite3WinInMutex(){
|
||||
#ifdef SQLITE_W32_THREADS
|
||||
return inMutex && mutexOwner==GetCurrentThread();
|
||||
#else
|
||||
return inMutex;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user