1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Have mem3.c and mem5.c grab a mutex when required. Include them both in the amalgamation again. (CVS 5306)

FossilOrigin-Name: 9e3c95ff4048cd8e4c56acf7a8ebedc49621e9c7
This commit is contained in:
danielk1977
2008-06-25 14:57:53 +00:00
parent 3f994d06ff
commit 6b39c2e40b
7 changed files with 81 additions and 74 deletions

View File

@@ -1,5 +1,5 @@
C Test\senhancements,\sespecially\sto\sthe\snew\scompound-SELECT\smerge\slogic.\s(CVS\s5305) 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:31:53 D 2008-06-25T14:57:54
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in ff6f90048555a0088f6a4b7406bed5e55a7c4eff F Makefile.in ff6f90048555a0088f6a4b7406bed5e55a7c4eff
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -119,9 +119,9 @@ F src/malloc.c f52166df8abd7ff6990dbee1a0ce3534addc8617
F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a F src/md5.c 008216bbb5d34c6fbab5357aa68575ad8a31516a
F src/mem1.c 8340fa5f969e9f9b9bdeb54106457a2003456d2b F src/mem1.c 8340fa5f969e9f9b9bdeb54106457a2003456d2b
F src/mem2.c 23f9538f35fbcd5665afe7056a56be0c7ed65aa7 F src/mem2.c 23f9538f35fbcd5665afe7056a56be0c7ed65aa7
F src/mem3.c 8ecfb0a61a363f34922fe3f73e698adf229eb55a F src/mem3.c 8d34a22617a0eb96c05a83fc2c4fbbaed6bcfde1
F src/mem4.c 6703adb1717b26d9d70a1c2586b4b7b7ffee7909 F src/mem4.c 6703adb1717b26d9d70a1c2586b4b7b7ffee7909
F src/mem5.c 604b5989eb11bee83f4114208f8d6df0ebbe50df F src/mem5.c d0c7c8506eb3f64c0ea0f1e8defab4043f531dad
F src/mutex.c a485a0eac8ee2cd95f66e565b4c6696c18db968f F src/mutex.c a485a0eac8ee2cd95f66e565b4c6696c18db968f
F src/mutex.h 236677b27760d85701b5872d01b5cafedde5f0a9 F src/mutex.h 236677b27760d85701b5872d01b5cafedde5f0a9
F src/mutex_os2.c 9c5637aa4c307c552566d0f0b3bd206245b54a97 F src/mutex_os2.c 9c5637aa4c307c552566d0f0b3bd206245b54a97
@@ -161,7 +161,7 @@ F src/test9.c 4615ef08750245a2d96aaa7cbe2fb4aff2b57acc
F src/test_async.c fb5ab7b54c0b4ece9e2283b9c38314ba5d40bab6 F src/test_async.c fb5ab7b54c0b4ece9e2283b9c38314ba5d40bab6
F src/test_autoext.c 5e892ab84aece3f0428920bf46923f16ac83962a F src/test_autoext.c 5e892ab84aece3f0428920bf46923f16ac83962a
F src/test_btree.c c1308ba0b88ab577fa56c9e493a09829dfcded9c 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_devsym.c 6012cb8e3acf812513511025a4fa5d626e0ba19b
F src/test_func.c f4aafa10f17d52c43a64b47717265802e6e552b3 F src/test_func.c f4aafa10f17d52c43a64b47717265802e6e552b3
F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f
@@ -422,7 +422,7 @@ F test/pager2.test c025f91b75fe65e85febda64d9416428b8a5cab5
F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4 F test/pager3.test 2323bf27fd5bd887b580247e5bce500ceee994b4
F test/pageropt.test 6df72c441db0a037b7ec6990d16311c24fbea77b F test/pageropt.test 6df72c441db0a037b7ec6990d16311c24fbea77b
F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e F test/pagesize.test e0a8b3fe80f8b8e808d94a00734c7a18c76c407e
F test/permutations.test 23b6ff4ef5f8f1b78d9eb47fda8f8ad080757f49 F test/permutations.test e915c7125487a734cf9fc94c9653fe0a05c08d29
F test/pragma.test 44bc52afa72cabfeae82641e0033ca24919f3ce8 F test/pragma.test 44bc52afa72cabfeae82641e0033ca24919f3ce8
F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
F test/printf.test c3405535b418d454e8a52196a0fc592ec9eec58d F test/printf.test c3405535b418d454e8a52196a0fc592ec9eec58d
@@ -579,7 +579,7 @@ F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf
F tool/mkkeywordhash.c ef93810fc41fb3d3dbacf9a33a29be88ea99ffa9 F tool/mkkeywordhash.c ef93810fc41fb3d3dbacf9a33a29be88ea99ffa9
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
F tool/mksqlite3c.tcl 5012f63f6366db547fa5a98ec62e9c8fd0e6cd47 F tool/mksqlite3c.tcl d7fea82624d6f7c4bfee3be558038d7f27913189
F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87 F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87
F tool/omittest.tcl 7d1fdf469e2f4d175f70c36e469db64a1626fabb F tool/omittest.tcl 7d1fdf469e2f4d175f70c36e469db64a1626fabb
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
@@ -594,7 +594,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 30ff6bb0b2d1068d28e86ac90bb9f454e4537a2d P edf7f518361902924105142a8c67b898ba7d532f
R c93b123df0b25165ffd3a040169a5b55 R 1a009318bac5f3e776bc54f3122c8111
U drh U danielk1977
Z 0b17565ed474d5b4889c83b3477691a8 Z 0a0f9328bf9a2e8862b4f65895b7ec64

View File

@@ -1 +1 @@
edf7f518361902924105142a8c67b898ba7d532f 9e3c95ff4048cd8e4c56acf7a8ebedc49621e9c7

View File

@@ -23,7 +23,7 @@
** This version of the memory allocation subsystem is included ** This version of the memory allocation subsystem is included
** in the build only if SQLITE_ENABLE_MEMSYS3 is defined. ** 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" #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. ** 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
** Also: Initialize the memory allocation subsystem the first time ** sqlite3Config.bMemStat is true.
** this routine is called.
*/ */
static void memsys3Enter(void){ static void memsys3Enter(void){
#if 0 if( sqlite3Config.bMemstat==0 && mem3.mutex==0 ){
if( mem3.mutex==0 ){
mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
} }
sqlite3_mutex_enter(mem3.mutex); sqlite3_mutex_enter(mem3.mutex);
#endif
} }
static void memsys3Leave(void){ static void memsys3Leave(void){
sqlite3_mutex_leave(mem3.mutex);
} }
/* /*

View File

@@ -23,7 +23,7 @@
** This version of the memory allocation subsystem is included ** This version of the memory allocation subsystem is included
** in the build only if SQLITE_ENABLE_MEMSYS5 is defined. ** 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" #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. ** 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
** Also: Initialize the memory allocation subsystem the first time ** sqlite3Config.bMemStat is true.
** this routine is called.
*/ */
static void memsys5Enter(void){ 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){ static void memsys5Leave(void){
sqlite3_mutex_leave(mem5.mutex);
} }
/* /*

View File

@@ -16,7 +16,7 @@
** The focus of this file is providing the TCL testing layer ** The focus of this file is providing the TCL testing layer
** access to compile-time constants. ** 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" #include "sqliteLimit.h"
@@ -70,13 +70,13 @@ static void set_options(Tcl_Interp *interp){
Tcl_SetVar2(interp, "sqlite_options", "memdebug", "0", TCL_GLOBAL_ONLY); Tcl_SetVar2(interp, "sqlite_options", "memdebug", "0", TCL_GLOBAL_ONLY);
#endif #endif
#ifdef SQLITE_MEMORY_SIZE #ifdef SQLITE_ENABLE_MEMSYS3
Tcl_SetVar2(interp, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY); Tcl_SetVar2(interp, "sqlite_options", "mem3", "1", TCL_GLOBAL_ONLY);
#else #else
Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY); Tcl_SetVar2(interp, "sqlite_options", "mem3", "0", TCL_GLOBAL_ONLY);
#endif #endif
#ifdef SQLITE_POW2_MEMORY_SIZE #ifdef SQLITE_ENABLE_MEMSYS5
Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY); Tcl_SetVar2(interp, "sqlite_options", "mem5", "1", TCL_GLOBAL_ONLY);
#else #else
Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY); Tcl_SetVar2(interp, "sqlite_options", "mem5", "0", TCL_GLOBAL_ONLY);

View 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] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@@ -329,6 +329,7 @@ run_tests "autovacuum_ioerr" -description {
pragma auto_vacuum = 1 pragma auto_vacuum = 1
} -include ioerr.test } -include ioerr.test
ifcapable mem3 {
run_tests "memsys3" -description { run_tests "memsys3" -description {
Run tests using the allocator in mem3.c. Run tests using the allocator in mem3.c.
} -exclude { } -exclude {
@@ -352,9 +353,11 @@ run_tests "memsys3" -description {
install_malloc_faultsim 1 install_malloc_faultsim 1
sqlite3_initialize sqlite3_initialize
} }
}
ifcapable mem5 {
run_tests "memsys5" -description { run_tests "memsys5" -description {
Run tests using the allocator in mem3.c. Run tests using the allocator in mem5.c.
} -exclude { } -exclude {
incrblob2.test manydb.test autovacuum.test bigrow.test incrblob2.test manydb.test autovacuum.test bigrow.test
collate5.test delete3.test index2.test ioerr.test join3.test collate5.test delete3.test index2.test ioerr.test join3.test
@@ -376,6 +379,7 @@ run_tests "memsys5" -description {
install_malloc_faultsim 1 install_malloc_faultsim 1
sqlite3_initialize sqlite3_initialize
} }
}
# run_tests "crash_safe_append" -description { # run_tests "crash_safe_append" -description {
# Run crash.test with persistent journals on a SAFE_APPEND file-system. # Run crash.test with persistent journals on a SAFE_APPEND file-system.

View File

@@ -211,6 +211,8 @@ foreach file {
fault.c fault.c
mem1.c mem1.c
mem2.c mem2.c
mem3.c
mem5.c
mutex.c mutex.c
mutex_os2.c mutex_os2.c
mutex_unix.c mutex_unix.c