Use a symbolic constant instead of a literal (-1) to identify a
warn-on-contention mutex. FossilOrigin-Name: 12a23c0a66fac5c9674120b390f6abaeaba3f7ff04693b281af1eefb93d6f47c
This commit is contained in:
parent
61f8e86f93
commit
a90a2d58a4
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sbuilds\swith\sboth\sSQLITE_ENABLE_MULTITHREADED_CHECKS\sand\nSQLITE_THREADSAFE=0\sdefined.
|
||||
D 2017-11-25T21:09:29.272
|
||||
C Use\sa\ssymbolic\sconstant\sinstead\sof\sa\sliteral\s(-1)\sto\sidentify\sa\nwarn-on-contention\smutex.
|
||||
D 2017-11-28T07:47:57.520
|
||||
F Makefile.in 6a879cbf01e37f9eac131414955f71774b566502d9a57ded1b8585b507503cb8
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc e5d7606238f55816da99f719969598df5b091aa2e9a6935c9412fcae8f53fc44
|
||||
@ -445,7 +445,7 @@ F src/mem3.c 8768ac94694f31ffaf8b4d0ea5dc08af7010a35a
|
||||
F src/mem5.c 9bf955937b07f8c32541c8a9991f33ce3173d944
|
||||
F src/memjournal.c 6f3d36a0a8f72f48f6c3c722f04301ac64f2515435fa42924293e46fc7994661
|
||||
F src/msvc.h 4942752b6a253116baaa8de75256c51a459a5e81
|
||||
F src/mutex.c 38addb10f90641b5f88521f7099e729ef10e3f0ac50bd6b9196183fb313a0378
|
||||
F src/mutex.c 20172f2cc43c4542f7860ab6bafdd16965822c4e56650d62628059a48c7f43c4
|
||||
F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85
|
||||
F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4
|
||||
F src/mutex_unix.c 27bb6cc49485ee46711a6580ab7b3f1402211d23
|
||||
@ -1678,7 +1678,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P a66886ac13aa6d8ccbb6d673ddd00267c93e3ee1fbc158236fce3157d150868d
|
||||
R e1844ccd94c28116d72c961404a2fb64
|
||||
P 7d0b12fcb58353b883ffce77df824a5cc8b1e913a21ec3f22fb73481a398c916
|
||||
R a940a7b7e2663c64f019728def2f503f
|
||||
U dan
|
||||
Z 03bc6023c96e908c306e6b560dfce5a2
|
||||
Z d7c77380d4461a6101913d9af19a0151
|
||||
|
@ -1 +1 @@
|
||||
7d0b12fcb58353b883ffce77df824a5cc8b1e913a21ec3f22fb73481a398c916
|
||||
12a23c0a66fac5c9674120b390f6abaeaba3f7ff04693b281af1eefb93d6f47c
|
17
src/mutex.c
17
src/mutex.c
@ -44,7 +44,12 @@ static SQLITE_WSD int mutexIsInit = 0;
|
||||
|
||||
/*
|
||||
** Type for all mutexes used when SQLITE_ENABLE_MULTITHREADED_CHECKS
|
||||
** is defined.
|
||||
** is defined. Variable CheckMutex.mutex is a pointer to the real mutex
|
||||
** allocated by the system mutex implementation. Variable iType is usually set
|
||||
** to the type of mutex requested - SQLITE_MUTEX_RECURSIVE, SQLITE_MUTEX_FAST
|
||||
** or one of the static mutex identifiers. Or, if this is a recursive mutex
|
||||
** that has been configured using sqlite3MutexWarnOnContention(), it is
|
||||
** set to SQLITE_MUTEX_WARNONCONTENTION.
|
||||
*/
|
||||
typedef struct CheckMutex CheckMutex;
|
||||
struct CheckMutex {
|
||||
@ -52,6 +57,8 @@ struct CheckMutex {
|
||||
sqlite3_mutex *mutex;
|
||||
};
|
||||
|
||||
#define SQLITE_MUTEX_WARNONCONTENTION (-1)
|
||||
|
||||
/*
|
||||
** Pointer to real mutex methods object used by the CheckMutex
|
||||
** implementation. Set by checkMutexInit().
|
||||
@ -122,6 +129,10 @@ static sqlite3_mutex *checkMutexAlloc(int iType){
|
||||
** Free a mutex.
|
||||
*/
|
||||
static void checkMutexFree(sqlite3_mutex *p){
|
||||
assert( SQLITE_MUTEX_RECURSIVE<2 );
|
||||
assert( SQLITE_MUTEX_FAST<2 );
|
||||
assert( SQLITE_MUTEX_WARNONCONTENTION<2 );
|
||||
|
||||
#if SQLITE_ENABLE_API_ARMOR
|
||||
if( p->iType<2 ){
|
||||
#endif
|
||||
@ -142,7 +153,7 @@ static void checkMutexFree(sqlite3_mutex *p){
|
||||
*/
|
||||
static void checkMutexEnter(sqlite3_mutex *p){
|
||||
CheckMutex *pCheck = (CheckMutex*)p;
|
||||
if( pCheck->iType<0 ){
|
||||
if( pCheck->iType==SQLITE_MUTEX_WARNONCONTENTION ){
|
||||
if( SQLITE_OK==pGlobalMutexMethods->xMutexTry(pCheck->mutex) ){
|
||||
return;
|
||||
}
|
||||
@ -197,7 +208,7 @@ void sqlite3MutexWarnOnContention(sqlite3_mutex *p){
|
||||
if( sqlite3GlobalConfig.mutex.xMutexAlloc==checkMutexAlloc ){
|
||||
CheckMutex *pCheck = (CheckMutex*)p;
|
||||
assert( pCheck->iType==SQLITE_MUTEX_RECURSIVE );
|
||||
pCheck->iType = -1;
|
||||
pCheck->iType = SQLITE_MUTEX_WARNONCONTENTION;
|
||||
}
|
||||
}
|
||||
#endif /* ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS */
|
||||
|
Loading…
Reference in New Issue
Block a user