Move the sqlite3SharedCacheEnabled global and the inProgress static variable (function sqlite3_initialize()) into the global sqlite3Config structure. This is required for the OMIT_WSD feature to work on some platforms. (CVS 5662)

FossilOrigin-Name: 88c82759946910b5ffdd5febc17356403f986c2e
This commit is contained in:
danielk1977 2008-09-02 14:07:24 +00:00
parent 263ac19474
commit 502b4e00c6
6 changed files with 26 additions and 29 deletions

View File

@ -1,5 +1,5 @@
C Add\sa\s'const'\sto\sthe\sopcodeProperty\sarray\sin\svdbe.c.\s(CVS\s5661) C Move\sthe\ssqlite3SharedCacheEnabled\sglobal\sand\sthe\sinProgress\sstatic\svariable\s(function\ssqlite3_initialize())\sinto\sthe\sglobal\ssqlite3Config\sstructure.\sThis\sis\srequired\sfor\sthe\sOMIT_WSD\sfeature\sto\swork\son\ssome\splatforms.\s(CVS\s5662)
D 2008-09-02T11:05:02 D 2008-09-02T14:07:24
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 689e14735f862a5553bceef206d8c13e29504e44 F Makefile.in 689e14735f862a5553bceef206d8c13e29504e44
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -97,7 +97,7 @@ F src/attach.c db3f4a60538733c1e4dcb9d0217a6e0d6ccd615b
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627 F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d
F src/btmutex.c 709cad2cdca0afd013f0f612363810e53f59ec53 F src/btmutex.c 709cad2cdca0afd013f0f612363810e53f59ec53
F src/btree.c 3c251cac0dbf763020e43aa66afa4a79356c4482 F src/btree.c 70706ed6c15a2b6f37b84454386d80fe8ff3a58a
F src/btree.h 6371c5e599fab391a150c96afbc10062b276d107 F src/btree.h 6371c5e599fab391a150c96afbc10062b276d107
F src/btreeInt.h ab18c7b4980314e9e4b402e5dcde09f3c2545576 F src/btreeInt.h ab18c7b4980314e9e4b402e5dcde09f3c2545576
F src/build.c 160c71acca8f643f436ed6c1ee2f684c88df4dfe F src/build.c 160c71acca8f643f436ed6c1ee2f684c88df4dfe
@ -116,7 +116,7 @@ F src/insert.c 110cca7845ed5a66c08fdd413b02e706ae34455f
F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3 F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3
F src/loadext.c 6581a5bbc4d74fcd46dbbcfd695a6a5417f778a2 F src/loadext.c 6581a5bbc4d74fcd46dbbcfd695a6a5417f778a2
F src/main.c 756541b024aeaedee0c803f33e06bf16aef19ab6 F src/main.c bebdb97ae38f9d552b302f11a8b1ec80a4d3b9e4
F src/malloc.c fb23bfbcc5c93180b787bd746c7387289028d482 F src/malloc.c fb23bfbcc5c93180b787bd746c7387289028d482
F src/mem1.c 5a529ff121c55ab067be14de00f86f6dcc4f4fb9 F src/mem1.c 5a529ff121c55ab067be14de00f86f6dcc4f4fb9
F src/mem2.c f87e681d0d1ed8436870d089332ed0d27d885b5c F src/mem2.c f87e681d0d1ed8436870d089332ed0d27d885b5c
@ -149,12 +149,12 @@ F src/select.c eec7c5f28a0c75fdd8500630435af176bba73219
F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967 F src/shell.c d83b578a8ccdd3e0e7fef4388a0887ce9f810967
F src/sqlite.h.in 81c37dcbd5bb1b1a5f6cdd96a67e82e6a0c3d1da F src/sqlite.h.in 81c37dcbd5bb1b1a5f6cdd96a67e82e6a0c3d1da
F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e F src/sqlite3ext.h 1e3887c9bd3ae66cb599e922824b04cd0d0f2c3e
F src/sqliteInt.h 796e1b04a34462a451cd1672b68a1820c2b9c70a F src/sqliteInt.h 4e81ab61bc9a942f0dafdb8c2cec7825f6eba2f5
F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8 F src/table.c 22744786199c9195720c15a7a42cb97b2e2728d8
F src/tclsqlite.c 01312c2af41189ff20335d6ac64e3dbda57e627b F src/tclsqlite.c 01312c2af41189ff20335d6ac64e3dbda57e627b
F src/test1.c 07f56e5495a2abc3ed1cec74836dedd5f829eb00 F src/test1.c 349606445a5a938e9fa9b5e410413632c6c25f87
F src/test2.c eaa77124786649eedf47d3c5e94d8070c0da228f F src/test2.c eaa77124786649eedf47d3c5e94d8070c0da228f
F src/test3.c e85b7ce5c28c3ce7fbdbf7f98e1467b19786c62b F src/test3.c e85b7ce5c28c3ce7fbdbf7f98e1467b19786c62b
F src/test4.c 41056378671e7b00e6305fa9ac6fa27e6f96f406 F src/test4.c 41056378671e7b00e6305fa9ac6fa27e6f96f406
@ -630,7 +630,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 46acaf58e11ebe69e4fb5f171d3ee29f056d8e68 P 29c9a80294398a349bc7cf0fb84cd4ef8a9e2f60
R 509902146f627322a8ff8638644cae64 R 8d35d3261ce4d6b4c41025ca53bd27df
U danielk1977 U danielk1977
Z 9cbec7a0d066203372160256f057c075 Z e602fc4ab77bd0708d41bbe674d74574

View File

@ -1 +1 @@
29c9a80294398a349bc7cf0fb84cd4ef8a9e2f60 88c82759946910b5ffdd5febc17356403f986c2e

View File

@ -9,7 +9,7 @@
** May you share freely, never taking more than you give. ** May you share freely, never taking more than you give.
** **
************************************************************************* *************************************************************************
** $Id: btree.c,v 1.507 2008/09/02 09:38:07 danielk1977 Exp $ ** $Id: btree.c,v 1.508 2008/09/02 14:07:24 danielk1977 Exp $
** **
** This file implements a external (disk-based) database using BTrees. ** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information. ** See the header comment on "btreeInt.h" for additional information.
@ -38,18 +38,15 @@ int sqlite3BtreeTrace=0; /* True to enable tracing */
#ifndef SQLITE_OMIT_SHARED_CACHE #ifndef SQLITE_OMIT_SHARED_CACHE
/* /*
** A flag to indicate whether or not shared cache is enabled. Also, ** A list of BtShared objects that are eligible for participation
** a list of BtShared objects that are eligible for participation ** in shared cache. This variable has file scope during normal builds,
** in shared cache. The variables have file scope during normal builds, ** but the test harness needs to access it so we make it global for
** but the test harness needs to access these variables so we make them ** test builds.
** global for test builds.
*/ */
#ifdef SQLITE_TEST #ifdef SQLITE_TEST
BtShared *SQLITE_WSD sqlite3SharedCacheList = 0; BtShared *SQLITE_WSD sqlite3SharedCacheList = 0;
SQLITE_WSD int sqlite3SharedCacheEnabled = 0;
#else #else
static BtShared *SQLITE_WSD sqlite3SharedCacheList = 0; static BtShared *SQLITE_WSD sqlite3SharedCacheList = 0;
static SQLITE_WSD int sqlite3SharedCacheEnabled = 0;
#endif #endif
#endif /* SQLITE_OMIT_SHARED_CACHE */ #endif /* SQLITE_OMIT_SHARED_CACHE */
@ -62,7 +59,7 @@ static SQLITE_WSD int sqlite3SharedCacheEnabled = 0;
** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2(). ** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2().
*/ */
int sqlite3_enable_shared_cache(int enable){ int sqlite3_enable_shared_cache(int enable){
GLOBAL(int, sqlite3SharedCacheEnabled) = enable; sqlite3GlobalConfig.sharedCacheEnabled = enable;
return SQLITE_OK; return SQLITE_OK;
} }
#endif #endif
@ -1232,7 +1229,7 @@ int sqlite3BtreeOpen(
&& (db->flags & SQLITE_Vtab)==0 && (db->flags & SQLITE_Vtab)==0
&& zFilename && zFilename[0] && zFilename && zFilename[0]
){ ){
if( GLOBAL(int,sqlite3SharedCacheEnabled) ){ if( sqlite3GlobalConfig.sharedCacheEnabled ){
int nFullPathname = pVfs->mxPathname+1; int nFullPathname = pVfs->mxPathname+1;
char *zFullPathname = sqlite3Malloc(nFullPathname); char *zFullPathname = sqlite3Malloc(nFullPathname);
sqlite3_mutex *mutexShared; sqlite3_mutex *mutexShared;

View File

@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be ** other files are for internal use by SQLite and should not be
** accessed by users of the library. ** accessed by users of the library.
** **
** $Id: main.c,v 1.496 2008/09/02 09:38:07 danielk1977 Exp $ ** $Id: main.c,v 1.497 2008/09/02 14:07:24 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@ -85,7 +85,6 @@ char *sqlite3_temp_directory = 0;
** without blocking. ** without blocking.
*/ */
int sqlite3_initialize(void){ int sqlite3_initialize(void){
SQLITE_WSD static int inProgress = 0; /* Prevent recursion */
sqlite3_mutex *pMaster; /* The main static mutex */ sqlite3_mutex *pMaster; /* The main static mutex */
int rc; /* Result code */ int rc; /* Result code */
@ -152,9 +151,9 @@ int sqlite3_initialize(void){
** recursive calls might also be possible. ** recursive calls might also be possible.
*/ */
sqlite3_mutex_enter(sqlite3GlobalConfig.pInitMutex); sqlite3_mutex_enter(sqlite3GlobalConfig.pInitMutex);
if( sqlite3GlobalConfig.isInit==0 && GLOBAL(int, inProgress)==0 ){ if( sqlite3GlobalConfig.isInit==0 && sqlite3GlobalConfig.inProgress==0 ){
FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions); FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions);
GLOBAL(int, inProgress) = 1; sqlite3GlobalConfig.inProgress = 1;
memset(pHash, 0, sizeof(sqlite3GlobalFunctions)); memset(pHash, 0, sizeof(sqlite3GlobalFunctions));
sqlite3RegisterGlobalFunctions(); sqlite3RegisterGlobalFunctions();
rc = sqlite3_os_init(); rc = sqlite3_os_init();
@ -163,7 +162,7 @@ int sqlite3_initialize(void){
sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage, sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage,
sqlite3GlobalConfig.szPage, sqlite3GlobalConfig.nPage); sqlite3GlobalConfig.szPage, sqlite3GlobalConfig.nPage);
} }
GLOBAL(int, inProgress) = 0; sqlite3GlobalConfig.inProgress = 0;
sqlite3GlobalConfig.isInit = (rc==SQLITE_OK ? 1 : 0); sqlite3GlobalConfig.isInit = (rc==SQLITE_OK ? 1 : 0);
} }
sqlite3_mutex_leave(sqlite3GlobalConfig.pInitMutex); sqlite3_mutex_leave(sqlite3GlobalConfig.pInitMutex);

View File

@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Internal interface definitions for SQLite. ** Internal interface definitions for SQLite.
** **
** @(#) $Id: sqliteInt.h,v 1.768 2008/09/02 00:52:52 drh Exp $ ** @(#) $Id: sqliteInt.h,v 1.769 2008/09/02 14:07:24 danielk1977 Exp $
*/ */
#ifndef _SQLITEINT_H_ #ifndef _SQLITEINT_H_
#define _SQLITEINT_H_ #define _SQLITEINT_H_
@ -1949,11 +1949,13 @@ struct Sqlite3Config {
int szPage; /* Size of each page in pPage[] */ int szPage; /* Size of each page in pPage[] */
int nPage; /* Number of pages in pPage[] */ int nPage; /* Number of pages in pPage[] */
int isInit; /* True after initialization has finished */ int isInit; /* True after initialization has finished */
int inProgress; /* True while initialization in progress */
int isMallocInit; /* True after malloc is initialized */ int isMallocInit; /* True after malloc is initialized */
sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */ sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */
int nRefInitMutex; /* Number of users of pInitMutex */ int nRefInitMutex; /* Number of users of pInitMutex */
int nSmall; /* alloc size threshold used by mem6.c */ int nSmall; /* alloc size threshold used by mem6.c */
int mxParserStack; /* maximum depth of the parser stack */ int mxParserStack; /* maximum depth of the parser stack */
int sharedCacheEnabled; /* true if shared-cache mode enabled */
}; };
/* /*

View File

@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated ** is not included in the SQLite library. It is used for automated
** testing of the SQLite library. ** testing of the SQLite library.
** **
** $Id: test1.c,v 1.323 2008/09/02 00:52:52 drh Exp $ ** $Id: test1.c,v 1.324 2008/09/02 14:07:24 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "tcl.h" #include "tcl.h"
@ -1381,13 +1381,12 @@ static int test_enable_shared(
int rc; int rc;
int enable; int enable;
int ret = 0; int ret = 0;
extern int sqlite3SharedCacheEnabled;
if( objc!=2 && objc!=1 ){ if( objc!=2 && objc!=1 ){
Tcl_WrongNumArgs(interp, 1, objv, "?BOOLEAN?"); Tcl_WrongNumArgs(interp, 1, objv, "?BOOLEAN?");
return TCL_ERROR; return TCL_ERROR;
} }
ret = GLOBAL(int, sqlite3SharedCacheEnabled); ret = sqlite3GlobalConfig.sharedCacheEnabled;
if( objc==2 ){ if( objc==2 ){
if( Tcl_GetBooleanFromObj(interp, objv[1], &enable) ){ if( Tcl_GetBooleanFromObj(interp, objv[1], &enable) ){