Import common changes from the mutex initialization branch.

FossilOrigin-Name: 334720c01722478af0d3dfd6fe8bafd88ba09f49
This commit is contained in:
mistachkin 2015-09-12 18:57:45 +00:00
parent b3366b99c8
commit 04abf0878f
5 changed files with 22 additions and 13 deletions

View File

@ -1,5 +1,5 @@
C Update\sevidence\smarks\sdue\sto\swording\schanges\sin\srequirements\stext.\s\sNo\nchanges\sto\scode.
D 2015-09-11T20:54:44.879
C Import\scommon\schanges\sfrom\sthe\smutex\sinitialization\sbranch.
D 2015-09-12T18:57:45.818
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in f85066ce844a28b671aaeeff320921cd0ce36239
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -314,10 +314,10 @@ F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534
F src/mem5.c 61eeb90134f9a5be6c2e68d8daae7628b25953fb
F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85
F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495
F src/mutex.c a39809c6c33f1ebc9cc781186c338ad90433e1e7
F src/mutex.c 8e45800ee78e0cd1f1f3fe8e398853307f4a085c
F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85
F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4
F src/mutex_unix.c 7762c8ec907379204f2ed751a0e33663ab1c14d7
F src/mutex_unix.c 8cfa6e83c618d2fcae0fe63f4d2b5bb16b11a97a
F src/mutex_w32.c 2e025e6642eaf27597403690980f560d1a91f62c
F src/notify.c 9711a7575036f0d3040ba61bc6e217f13a9888e7
F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8
@ -345,7 +345,7 @@ F src/shell.c 6332ef06db1390ef812cfdff1fc97b4fd76cdd42
F src/sqlite.h.in dbaf8c3796e80221de4395b5f4f872abddb5f89f
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
F src/sqlite3ext.h 64350bf36833a56ad675e27392a913f417c5c308
F src/sqliteInt.h 788dc0ea7ba32ec9fec06c628c1792d7b4753d86
F src/sqliteInt.h b3e590f374b376a793b93e2387b8d5aca0fc92c4
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
F src/status.c f266ad8a2892d659b74f0f50cb6a88b6e7c12179
F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e
@ -1386,7 +1386,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P bfc7b84b766860d2e410702ba7c1166d7328309a
R ed47f4fa6e24d2d49fdba867f1c9ec47
U drh
Z fe2e843011e778f2686c50d38eded399
P 86781093bdb4c4fdedd228cb1c8961db48a483bb
R 65cef7a212785e2c4ed01bbc55ee07c1
U mistachkin
Z 122b4ea017ab904cde327a85d32df791

View File

@ -1 +1 @@
86781093bdb4c4fdedd228cb1c8961db48a483bb
334720c01722478af0d3dfd6fe8bafd88ba09f49

View File

@ -22,7 +22,7 @@
** allocate a mutex while the system is uninitialized.
*/
static SQLITE_WSD int mutexIsInit = 0;
#endif /* SQLITE_DEBUG */
#endif /* SQLITE_DEBUG && !defined(SQLITE_MUTEX_OMIT) */
#ifndef SQLITE_MUTEX_OMIT
@ -56,6 +56,7 @@ int sqlite3MutexInit(void){
sqlite3MemoryBarrier();
pTo->xMutexAlloc = pFrom->xMutexAlloc;
}
assert( sqlite3GlobalConfig.mutex.xMutexInit );
rc = sqlite3GlobalConfig.mutex.xMutexInit();
#ifdef SQLITE_DEBUG
@ -90,6 +91,7 @@ sqlite3_mutex *sqlite3_mutex_alloc(int id){
if( id<=SQLITE_MUTEX_RECURSIVE && sqlite3_initialize() ) return 0;
if( id>SQLITE_MUTEX_RECURSIVE && sqlite3MutexInit() ) return 0;
#endif
assert( sqlite3GlobalConfig.mutex.xMutexAlloc );
return sqlite3GlobalConfig.mutex.xMutexAlloc(id);
}
@ -98,6 +100,7 @@ sqlite3_mutex *sqlite3MutexAlloc(int id){
return 0;
}
assert( GLOBAL(int, mutexIsInit) );
assert( sqlite3GlobalConfig.mutex.xMutexAlloc );
return sqlite3GlobalConfig.mutex.xMutexAlloc(id);
}
@ -106,6 +109,7 @@ sqlite3_mutex *sqlite3MutexAlloc(int id){
*/
void sqlite3_mutex_free(sqlite3_mutex *p){
if( p ){
assert( sqlite3GlobalConfig.mutex.xMutexFree );
sqlite3GlobalConfig.mutex.xMutexFree(p);
}
}
@ -116,6 +120,7 @@ void sqlite3_mutex_free(sqlite3_mutex *p){
*/
void sqlite3_mutex_enter(sqlite3_mutex *p){
if( p ){
assert( sqlite3GlobalConfig.mutex.xMutexEnter );
sqlite3GlobalConfig.mutex.xMutexEnter(p);
}
}
@ -127,6 +132,7 @@ void sqlite3_mutex_enter(sqlite3_mutex *p){
int sqlite3_mutex_try(sqlite3_mutex *p){
int rc = SQLITE_OK;
if( p ){
assert( sqlite3GlobalConfig.mutex.xMutexTry );
return sqlite3GlobalConfig.mutex.xMutexTry(p);
}
return rc;
@ -140,6 +146,7 @@ int sqlite3_mutex_try(sqlite3_mutex *p){
*/
void sqlite3_mutex_leave(sqlite3_mutex *p){
if( p ){
assert( sqlite3GlobalConfig.mutex.xMutexLeave );
sqlite3GlobalConfig.mutex.xMutexLeave(p);
}
}
@ -150,9 +157,11 @@ void sqlite3_mutex_leave(sqlite3_mutex *p){
** intended for use inside assert() statements.
*/
int sqlite3_mutex_held(sqlite3_mutex *p){
assert( p==0 || sqlite3GlobalConfig.mutex.xMutexHeld );
return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p);
}
int sqlite3_mutex_notheld(sqlite3_mutex *p){
assert( p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld );
return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p);
}
#endif

View File

@ -86,7 +86,7 @@ static int pthreadMutexNotheld(sqlite3_mutex *p){
void sqlite3MemoryBarrier(void){
#if defined(SQLITE_MEMORY_BARRIER)
SQLITE_MEMORY_BARRIER;
#elif defined(__GNUC__)
#elif defined(__GNUC__) && GCC_VERSION>=4001000
__sync_synchronize();
#endif
}

View File

@ -3195,7 +3195,7 @@ const sqlite3_mem_methods *sqlite3MemGetMemsys5(void);
#if !defined(SQLITE_MUTEX_OMIT) && !defined(SQLITE_MUTEX_NOOP)
void sqlite3MemoryBarrier(void);
#else
# define sqlite3MemoryBarrier();
# define sqlite3MemoryBarrier()
#endif
sqlite3_int64 sqlite3StatusValue(int);