]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Have mem3.c and mem5.c grab a mutex when required. Include them both in the amalgamat...
authordanielk1977 <danielk1977@noemail.net>
Wed, 25 Jun 2008 14:57:53 +0000 (14:57 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Wed, 25 Jun 2008 14:57:53 +0000 (14:57 +0000)
FossilOrigin-Name: 9e3c95ff4048cd8e4c56acf7a8ebedc49621e9c7

manifest
manifest.uuid
src/mem3.c
src/mem5.c
src/test_config.c
test/permutations.test
tool/mksqlite3c.tcl

index 39f26f62afaeb23c4566c3f003417e1a4e0bba11..16a675e43c919b1cf36d8f968553b561ece9daf2 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Test\senhancements,\sespecially\sto\sthe\snew\scompound-SELECT\smerge\slogic.\s(CVS\s5305)
-D 2008-06-25T14:31:53
+C Have\smem3.c\sand\smem5.c\sgrab\sa\smutex\swhen\srequired.\sInclude\sthem\sboth\sin\sthe\samalgamation\sagain.\s(CVS\s5306)
+D 2008-06-25T14:57:54
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in ff6f90048555a0088f6a4b7406bed5e55a7c4eff
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -119,9 +119,9 @@ F src/malloc.c f52166df8abd7ff6990dbee1a0ce3534addc8617
 F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
 F src/mem1.c 8340fa5f969e9f9b9bdeb54106457a2003456d2b
 F src/mem2.c 23f9538f35fbcd5665afe7056a56be0c7ed65aa7
-F src/mem3.c 8ecfb0a61a363f34922fe3f73e698adf229eb55a
+F src/mem3.c 8d34a22617a0eb96c05a83fc2c4fbbaed6bcfde1
 F src/mem4.c 6703adb1717b26d9d70a1c2586b4b7b7ffee7909
-F src/mem5.c 604b5989eb11bee83f4114208f8d6df0ebbe50df
+F src/mem5.c d0c7c8506eb3f64c0ea0f1e8defab4043f531dad
 F src/mutex.c a485a0eac8ee2cd95f66e565b4c6696c18db968f
 F src/mutex.h 236677b27760d85701b5872d01b5cafedde5f0a9
 F src/mutex_os2.c 9c5637aa4c307c552566d0f0b3bd206245b54a97
@@ -161,7 +161,7 @@ F src/test9.c 4615ef08750245a2d96aaa7cbe2fb4aff2b57acc
 F src/test_async.c fb5ab7b54c0b4ece9e2283b9c38314ba5d40bab6
 F src/test_autoext.c 5e892ab84aece3f0428920bf46923f16ac83962a
 F src/test_btree.c c1308ba0b88ab577fa56c9e493a09829dfcded9c
-F src/test_config.c 0a2b732a6fd9cfef39417a303b76a402c963d89b
+F src/test_config.c 95d63ffc4f06f3f89d8450662140dd1bd793083a
 F src/test_devsym.c 6012cb8e3acf812513511025a4fa5d626e0ba19b
 F src/test_func.c f4aafa10f17d52c43a64b47717265802e6e552b3
 F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
@@ -422,7 +422,7 @@ F test/pager2.test c025f91b75fe65e85febda64d9416428b8a5cab5
 F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
 F test/pageropt.test 6df72c441db0a037b7ec6990d16311c24fbea77b
 F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e
-F test/permutations.test 23b6ff4ef5f8f1b78d9eb47fda8f8ad080757f49
+F test/permutations.test e915c7125487a734cf9fc94c9653fe0a05c08d29
 F test/pragma.test 44bc52afa72cabfeae82641e0033ca24919f3ce8
 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
 F test/printf.test c3405535b418d454e8a52196a0fc592ec9eec58d
@@ -579,7 +579,7 @@ F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
 F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf
 F tool/mkkeywordhash.c ef93810fc41fb3d3dbacf9a33a29be88ea99ffa9
 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
-F tool/mksqlite3c.tcl 5012f63f6366db547fa5a98ec62e9c8fd0e6cd47
+F tool/mksqlite3c.tcl d7fea82624d6f7c4bfee3be558038d7f27913189
 F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87
 F tool/omittest.tcl 7d1fdf469e2f4d175f70c36e469db64a1626fabb
 F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
@@ -594,7 +594,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 30ff6bb0b2d1068d28e86ac90bb9f454e4537a2d
-R c93b123df0b25165ffd3a040169a5b55
-U drh
-Z 0b17565ed474d5b4889c83b3477691a8
+P edf7f518361902924105142a8c67b898ba7d532f
+R 1a009318bac5f3e776bc54f3122c8111
+U danielk1977
+Z 0a0f9328bf9a2e8862b4f65895b7ec64
index 3136e762ae628dbf1d9209ff66086d723068912e..047abb925efc872d3f3b2c3c3ff4a76235be8a23 100644 (file)
@@ -1 +1 @@
-edf7f518361902924105142a8c67b898ba7d532f
\ No newline at end of file
+9e3c95ff4048cd8e4c56acf7a8ebedc49621e9c7
\ No newline at end of file
index d2f8da927c2be85f1770e00a868d2e0bfd508571..2582dda5539a94db8a9838c5725b9c27f944712d 100644 (file)
@@ -23,7 +23,7 @@
 ** This version of the memory allocation subsystem is included
 ** in the build only if SQLITE_ENABLE_MEMSYS3 is defined.
 **
-** $Id: mem3.c,v 1.16 2008/06/25 10:34:35 danielk1977 Exp $
+** $Id: mem3.c,v 1.17 2008/06/25 14:57:54 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -216,20 +216,18 @@ static void memsys3Link(u32 i){
 }
 
 /*
-** Enter the mutex mem3.mutex. Allocate it if it is not already allocated.
-**
-** Also:  Initialize the memory allocation subsystem the first time
-** this routine is called.
+** If the STATIC_MEM mutex is not already held, obtain it now. The mutex
+** will already be held (obtained by code in malloc.c) if
+** sqlite3Config.bMemStat is true.
 */
 static void memsys3Enter(void){
-#if 0
-  if( mem3.mutex==0 ){
+  if( sqlite3Config.bMemstat==0 && mem3.mutex==0 ){
     mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
   }
   sqlite3_mutex_enter(mem3.mutex);
-#endif
 }
 static void memsys3Leave(void){
+  sqlite3_mutex_leave(mem3.mutex);
 }
 
 /*
index 4ce5bf09e8589c18d205fa05e399ae00e8db2f31..179528dd0593d8ec7ea67d002c671ec4de9b818d 100644 (file)
@@ -23,7 +23,7 @@
 ** This version of the memory allocation subsystem is included
 ** in the build only if SQLITE_ENABLE_MEMSYS5 is defined.
 **
-** $Id: mem5.c,v 1.7 2008/06/25 14:26:08 danielk1977 Exp $
+** $Id: mem5.c,v 1.8 2008/06/25 14:57:54 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 
@@ -180,15 +180,18 @@ static void memsys5Link(int i, int iLogsize){
 }
 
 /*
-** Enter the mutex mem5.mutex. Allocate it if it is not already allocated.
-**
-** Also:  Initialize the memory allocation subsystem the first time
-** this routine is called.
+** If the STATIC_MEM mutex is not already held, obtain it now. The mutex
+** will already be held (obtained by code in malloc.c) if
+** sqlite3Config.bMemStat is true.
 */
 static void memsys5Enter(void){
+  if( sqlite3Config.bMemstat==0 && mem5.mutex==0 ){
+    mem5.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
+  }
+  sqlite3_mutex_enter(mem5.mutex);
 }
-
 static void memsys5Leave(void){
+  sqlite3_mutex_leave(mem5.mutex);
 }
 
 /*
index 50fe594950cdb8572fb88b7095004b182096425b..41117c51f266d55ec47eee29de3e1a913a76cba1 100644 (file)
@@ -16,7 +16,7 @@
 ** The focus of this file is providing the TCL testing layer
 ** access to compile-time constants.
 **
-** $Id: test_config.c,v 1.27 2008/06/12 12:51:37 drh Exp $
+** $Id: test_config.c,v 1.28 2008/06/25 14:57:54 danielk1977 Exp $
 */
 
 #include "sqliteLimit.h"
@@ -70,13 +70,13 @@ static void set_options(Tcl_Interp *interp){
   Tcl_SetVar2(interp, "sqlite_options", "memdebug", "0", TCL_GLOBAL_ONLY);
 #endif
 
-#ifdef SQLITE_MEMORY_SIZE
+#ifdef SQLITE_ENABLE_MEMSYS3
   Tcl_SetVar2(interp, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY);
 #else
   Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY);
 #endif
 
-#ifdef SQLITE_POW2_MEMORY_SIZE
+#ifdef SQLITE_ENABLE_MEMSYS5
   Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY);
 #else
   Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY);
index 44a8edf6eca7c8fd590a1e9374c2d1d1a05ca78b..8c2f6f22bbdbf4994183c8ce0cd07ed4846776d1 100644 (file)
@@ -9,7 +9,7 @@
 #
 #***********************************************************************
 #
-# $Id: permutations.test,v 1.6 2008/06/25 14:26:09 danielk1977 Exp $
+# $Id: permutations.test,v 1.7 2008/06/25 14:57:54 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -329,52 +329,56 @@ run_tests "autovacuum_ioerr" -description {
   pragma auto_vacuum = 1
 } -include ioerr.test
 
-run_tests "memsys3" -description {
-  Run tests using the allocator in mem3.c.
-} -exclude {
-  incrblob2.test manydb.test  autovacuum.test bigrow.test
-  collate5.test  delete3.test index2.test     ioerr.test  join3.test 
-  pagesize.test  bitvec.test  capi3.test      memsubsys1.test  limit.test
-  memdb.test     capi3c.test
-} -initialize {
-  catch {db close}
-  sqlite3_reset_auto_extension
-  sqlite3_shutdown
-  sqlite3_config_memsys3 1000000
-  install_malloc_faultsim 1 
-  sqlite3_initialize
-  autoinstall_test_functions
-} -shutdown {
-  catch {db close}
-  sqlite3_reset_auto_extension
-  sqlite3_shutdown
-  sqlite3_config_memsys3 0
-  install_malloc_faultsim 1 
-  sqlite3_initialize
+ifcapable mem3 {
+  run_tests "memsys3" -description {
+    Run tests using the allocator in mem3.c.
+  } -exclude {
+    incrblob2.test manydb.test  autovacuum.test bigrow.test
+    collate5.test  delete3.test index2.test     ioerr.test  join3.test 
+    pagesize.test  bitvec.test  capi3.test      memsubsys1.test  limit.test
+    memdb.test     capi3c.test
+  } -initialize {
+    catch {db close}
+    sqlite3_reset_auto_extension
+    sqlite3_shutdown
+    sqlite3_config_memsys3 1000000
+    install_malloc_faultsim 1 
+    sqlite3_initialize
+    autoinstall_test_functions
+  } -shutdown {
+    catch {db close}
+    sqlite3_reset_auto_extension
+    sqlite3_shutdown
+    sqlite3_config_memsys3 0
+    install_malloc_faultsim 1 
+    sqlite3_initialize
+  }
 }
 
-run_tests "memsys5" -description {
-  Run tests using the allocator in mem3.c.
-} -exclude {
-  incrblob2.test manydb.test  autovacuum.test bigrow.test
-  collate5.test  delete3.test index2.test     ioerr.test  join3.test 
-  pagesize.test  bitvec.test  capi3.test      memsubsys1.test  limit.test
-  memdb.test     capi3c.test  func.test
-} -initialize {
-  catch {db close}
-  sqlite3_reset_auto_extension
-  sqlite3_shutdown
-  sqlite3_config_memsys5 1000000
-  install_malloc_faultsim 1 
-  sqlite3_initialize
-  autoinstall_test_functions
-} -shutdown {
-  catch {db close}
-  sqlite3_reset_auto_extension
-  sqlite3_shutdown
-  sqlite3_config_memsys5 0
-  install_malloc_faultsim 1 
-  sqlite3_initialize
+ifcapable mem5 {
+  run_tests "memsys5" -description {
+    Run tests using the allocator in mem5.c.
+  } -exclude {
+    incrblob2.test manydb.test  autovacuum.test bigrow.test
+    collate5.test  delete3.test index2.test     ioerr.test  join3.test 
+    pagesize.test  bitvec.test  capi3.test      memsubsys1.test  limit.test
+    memdb.test     capi3c.test  func.test
+  } -initialize {
+    catch {db close}
+    sqlite3_reset_auto_extension
+    sqlite3_shutdown
+    sqlite3_config_memsys5 1000000
+    install_malloc_faultsim 1 
+    sqlite3_initialize
+    autoinstall_test_functions
+  } -shutdown {
+    catch {db close}
+    sqlite3_reset_auto_extension
+    sqlite3_shutdown
+    sqlite3_config_memsys5 0
+    install_malloc_faultsim 1 
+    sqlite3_initialize
+  }
 }
 
 # run_tests "crash_safe_append" -description {
index 4c1d0ba387b9ffce6605c995f8b4ef34aa483521..614d741777a36b6e0d8c28deb2e32c44c0f2cf03 100644 (file)
@@ -211,6 +211,8 @@ foreach file {
    fault.c
    mem1.c
    mem2.c
+   mem3.c
+   mem5.c
    mutex.c
    mutex_os2.c
    mutex_unix.c