Add more asserts to the mutex subsystem.

FossilOrigin-Name: 7562f1fbede70b19bbbb928e0a534203528b5b65
This commit is contained in:
mistachkin
2015-09-12 03:35:55 +00:00
parent db17a83295
commit 89e57dd671
3 changed files with 16 additions and 7 deletions
+6 -6
View File
@@ -1,5 +1,5 @@
C Fix\stypo\sin\sthe\sWin32\simplementation\sof\ssqlite3CompareAndSwap.
D 2015-09-12T01:17:20.881
C Add\smore\sasserts\sto\sthe\smutex\ssubsystem.
D 2015-09-12T03:35:55.815
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in f85066ce844a28b671aaeeff320921cd0ce36239
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -314,7 +314,7 @@ F src/mem3.c 61c9d47b792908c532ca3a62b999cf21795c6534
F src/mem5.c 61eeb90134f9a5be6c2e68d8daae7628b25953fb
F src/memjournal.c 3eb2c0b51adbd869cb6a44780323f05fa904dc85
F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495
F src/mutex.c de4293e5feb5dae2a1786283a2ae971e899f6745
F src/mutex.c 58c1a764c37ba3c139cfb9cd8c7449eb7b4d68d9
F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85
F src/mutex_noop.c f03e26ba8258399da23b51234f6b6a97197c1900
F src/mutex_unix.c a72043f2560147d8e85fe48a6aef682896deb3a0
@@ -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 dc2cf8974337ca1ef705aee4efd4a96b91ca3edd
R 3b92b5e82a5c0ea068da80dc7d0da694
P 31a26a1dd796e073e847e1e9c636f1976ffbb085
R 5a995daaaa1ffe3e122fa4de7896505a
U mistachkin
Z 476438ea83dd42d3fd5d143255ab7dd1
Z daf6fb5d405d4ff4a4a1528517fc9961
+1 -1
View File
@@ -1 +1 @@
31a26a1dd796e073e847e1e9c636f1976ffbb085
7562f1fbede70b19bbbb928e0a534203528b5b65
+9
View File
@@ -67,6 +67,7 @@ int sqlite3MutexInit(void){
mutexCopy(&sqlite3GlobalConfig.mutex, pFrom);
sqlite3MemoryBarrier();
}
assert( sqlite3GlobalConfig.mutex.xMutexInit );
rc = sqlite3GlobalConfig.mutex.xMutexInit();
#ifdef SQLITE_DEBUG
@@ -101,6 +102,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);
}
@@ -109,6 +111,7 @@ sqlite3_mutex *sqlite3MutexAlloc(int id){
return 0;
}
assert( GLOBAL(int, mutexIsInit) );
assert( sqlite3GlobalConfig.mutex.xMutexAlloc );
return sqlite3GlobalConfig.mutex.xMutexAlloc(id);
}
@@ -117,6 +120,7 @@ sqlite3_mutex *sqlite3MutexAlloc(int id){
*/
void sqlite3_mutex_free(sqlite3_mutex *p){
if( p ){
assert( sqlite3GlobalConfig.mutex.xMutexFree );
sqlite3GlobalConfig.mutex.xMutexFree(p);
}
}
@@ -127,6 +131,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);
}
}
@@ -138,6 +143,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;
@@ -151,6 +157,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);
}
}
@@ -161,9 +168,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