1
0
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:
drh
2006-01-18 14:20:17 +00:00
parent a3fad6f5f3
commit 332b1feaf1
3 changed files with 15 additions and 10 deletions

View File

@@ -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
}