aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2006-01-18 14:20:17 +0000
committerdrh <drh@noemail.net>2006-01-18 14:20:17 +0000
commit332b1feaf1067f317c2ee91ec39de1ed37e170c9 (patch)
treece770bafa0596c9b48aa75ba8a2b047ce1b3da93
parenta3fad6f5f3f480dc891d8d3df372bbc4e3da9e20 (diff)
downloadsqlite-332b1feaf1067f317c2ee91ec39de1ed37e170c9.tar.gz
sqlite-332b1feaf1067f317c2ee91ec39de1ed37e170c9.zip
Recursive mutexes in os_win.c. (CVS 2969)
FossilOrigin-Name: dd3e07cae4d0cbd4f8977e1dd11e0103e0e45b75
-rw-r--r--manifest12
-rw-r--r--manifest.uuid2
-rw-r--r--src/os_win.c11
3 files changed, 15 insertions, 10 deletions
diff --git a/manifest b/manifest
index 587c62a28..d7edeadf2 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Convert\sthe\sunix\sdriver\sto\suse\sa\srecusive\smutex.\s\sSimilar\schanges\sto\sthe\nwindows\sdriver\sare\spending.\s(CVS\s2968)
-D 2006-01-18T14:06:38
+C Recursive\smutexes\sin\sos_win.c.\s(CVS\s2969)
+D 2006-01-18T14:20:17
F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -57,7 +57,7 @@ F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c 7c085f807922309006f00b5fd8963865b92ff939
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
-F src/os_win.c b9cb6254698cd7c2587c27e65b78c585473c6ffa
+F src/os_win.c e1c0600129f2468c8a852ae61f7b7bacf72aa7dc
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c e84713f7196a81103cc8e2b55cebbaa1723c4926
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
@@ -341,7 +341,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 86eab9e53db8d7fecc789fe3d8cd8d7be3196fed
-R 79ed702da5352631a14fd5c72072c4b8
+P 8830bbbac8e0c9243956aac42dc9f86a0bd1fa07
+R 7ad1313dca6d71746c68d32b98aa5742
U drh
-Z d577dbc25e956de86c8f9b79929b1f93
+Z 25414a8af7b032353ad4c225fe562fb4
diff --git a/manifest.uuid b/manifest.uuid
index f6a576c10..2776453eb 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-8830bbbac8e0c9243956aac42dc9f86a0bd1fa07 \ No newline at end of file
+dd3e07cae4d0cbd4f8977e1dd11e0103e0e45b75 \ No newline at end of file
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
}