diff options
author | drh <drh@noemail.net> | 2006-01-18 14:20:17 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2006-01-18 14:20:17 +0000 |
commit | 332b1feaf1067f317c2ee91ec39de1ed37e170c9 (patch) | |
tree | ce770bafa0596c9b48aa75ba8a2b047ce1b3da93 /src/os_win.c | |
parent | a3fad6f5f3f480dc891d8d3df372bbc4e3da9e20 (diff) | |
download | sqlite-332b1feaf1067f317c2ee91ec39de1ed37e170c9.tar.gz sqlite-332b1feaf1067f317c2ee91ec39de1ed37e170c9.zip |
Recursive mutexes in os_win.c. (CVS 2969)
FossilOrigin-Name: dd3e07cae4d0cbd4f8977e1dd11e0103e0e45b75
Diffstat (limited to 'src/os_win.c')
-rw-r--r-- | src/os_win.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/os_win.c b/src/os_win.c index e184c3018..2d2341a08 100644 --- a/src/os_win.c +++ b/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 } |