]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fixed "Interlocked" logic error that prevented the "static" mutexes from being releas...
authorshane <shane@noemail.net>
Mon, 10 Aug 2009 03:23:21 +0000 (03:23 +0000)
committershane <shane@noemail.net>
Mon, 10 Aug 2009 03:23:21 +0000 (03:23 +0000)
FossilOrigin-Name: 04cafb7ee3b67a68c0604d7f1143feaec44be610

manifest
manifest.uuid
src/mutex_w32.c

index 9eee5e7f9d5be35bdfa6233847f2a57b878830c1..501da41d836b917c331b4dc14e488a3047f25b9e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Suppress\svarious\scompiler\swarnings.\s(CVS\s6963)
-D 2009-08-08T18:01:08
+C Fixed\s"Interlocked"\slogic\serror\sthat\sprevented\sthe\s"static"\smutexes\sfrom\sbeing\sreleased\swhen\ssqlite3_shutdown()\sis\scalled.\sTicket\s#4011.\s(CVS\s6964)
+D 2009-08-10T03:23:21
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -139,7 +139,7 @@ F src/mutex.h 9e686e83a88838dac8b9c51271c651e833060f1e
 F src/mutex_noop.c f5a07671f25a1a9bd7c10ad7107bc2585446200f
 F src/mutex_os2.c 6b5a74f812082a8483c3df05b47bbaac2424b9a0
 F src/mutex_unix.c 2f936339dfef1a4c142db290d575a3509b77315f
-F src/mutex_w32.c cd611ebe0671a05e3d5b4e3f37032a45eb2ce612
+F src/mutex_w32.c cee867e12fc3c02674d8ea6ea16032a3671aff3c
 F src/notify.c 0127121816d8a861deb0dfd111b495346bf233db
 F src/os.c 5029ae6c88d1869ad9034008a9531658d53438e4
 F src/os.h fa3f4aa0119ff721a2da4b47ffd74406ac864c05
@@ -741,7 +741,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746
-P 8293fa19c02abe0e2a7594b9bceac28929de8fdf
-R 1388774ac72d09f419d1b27cfbadc8a0
-U drh
-Z 0ab5f86d0c04eff0d1cfe3a04ab5c3f0
+P 257e9b575029f63277ed602d1402f87cfa15d22e
+R 7580883b146e79dce6cbe5347a4f71a2
+U shane
+Z 2db382aedef8e0c5b7864d5c95e06316
index 9154c2f409601d7a5a5c727279e327726a4808a1..de62a64294899d3fc32d66cdd5a0cde1831fac7e 100644 (file)
@@ -1 +1 @@
-257e9b575029f63277ed602d1402f87cfa15d22e
\ No newline at end of file
+04cafb7ee3b67a68c0604d7f1143feaec44be610
\ No newline at end of file
index 98e239e41cf3e4c04c194d2d91882501bbd030e3..402c80c61f352f14bbceb76a2b1be1ed5e81b771 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** This file contains the C functions that implement mutexes for win32
 **
-** $Id: mutex_w32.c,v 1.17 2009/06/01 17:10:22 shane Exp $
+** $Id: mutex_w32.c,v 1.18 2009/08/10 03:23:21 shane Exp $
 */
 #include "sqliteInt.h"
 
@@ -93,13 +93,14 @@ static long winMutex_lock = 0;
 
 static int winMutexInit(void){ 
   /* The first to increment to 1 does actual initialization */
-  if( InterlockedIncrement(&winMutex_lock)==1 ){
+  if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){
     int i;
     for(i=0; i<sizeof(winMutex_staticMutexes)/sizeof(winMutex_staticMutexes[0]); i++){
       InitializeCriticalSection(&winMutex_staticMutexes[i].mutex);
     }
     winMutex_isInit = 1;
   }else{
+    /* Someone else is in the process of initing the static mutexes */
     while( !winMutex_isInit ){
       Sleep(1);
     }
@@ -110,7 +111,7 @@ static int winMutexInit(void){
 static int winMutexEnd(void){ 
   /* The first to decrement to 0 does actual shutdown 
   ** (which should be the last to shutdown.) */
-  if( InterlockedDecrement(&winMutex_lock)==0 ){
+  if( InterlockedCompareExchange(&winMutex_lock, 0, 1)==1 ){
     if( winMutex_isInit==1 ){
       int i;
       for(i=0; i<sizeof(winMutex_staticMutexes)/sizeof(winMutex_staticMutexes[0]); i++){