From: mistachkin Date: Sun, 13 Sep 2015 18:45:50 +0000 (+0000) Subject: Experimental changes to avoid recusrively calling xMutexInit. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5c870cb03c972cc2eb994518c5ae0857b09ca383;p=thirdparty%2Fsqlite.git Experimental changes to avoid recusrively calling xMutexInit. FossilOrigin-Name: c9400ff167d9520119081c9b92436794dcd53d22 --- diff --git a/manifest b/manifest index b5bb47356c..82284b7b01 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\supdates\sfrom\strunk. -D 2015-09-13T18:43:53.759 +C Experimental\schanges\sto\savoid\srecusrively\scalling\sxMutexInit. +D 2015-09-13T18:45:50.134 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 a5c7d63f595ef4e2c7411fc627f1f6e3e8ee089b +F src/mutex.c b0fbea2cda9f8e81444f5f1b4b9f07c1a904269e 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 d8051f611acabc2aaf8d23e8707c2a45961be416 786333e05a75406bbd0b5c9c7beb8f16022eabec -R c5f00344bef9784bebe4d7d63d1f470a +P b42c2e2076da1a61f667876ff2c18e4ebed50a7f +R 7600913daf42127c1cd5acb5cae703c1 U mistachkin -Z ed5385a43675afcca5c372bcd0fa06ab +Z e012d74d229ec0f8fc3b071b4b2b7de3 diff --git a/manifest.uuid b/manifest.uuid index 3a234c8eb6..70a6fb34ec 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b42c2e2076da1a61f667876ff2c18e4ebed50a7f \ No newline at end of file +c9400ff167d9520119081c9b92436794dcd53d22 \ No newline at end of file diff --git a/src/mutex.c b/src/mutex.c index 6447a8d2ba..1d789ed17c 100644 --- a/src/mutex.c +++ b/src/mutex.c @@ -75,6 +75,7 @@ static void mutexCopy( ** Initialize the mutex system. */ int sqlite3MutexInit(void){ + static int initPending = 0; int rc; if( sqlite3CompareAndSwap((void * volatile *)&sqlite3GlobalConfig.pMutex, 0, &sqlite3GlobalConfig.mutex)==0 || mutexIsInvalid() ){ @@ -93,8 +94,12 @@ int sqlite3MutexInit(void){ mutexCopy(&sqlite3GlobalConfig.mutex, pFrom); sqlite3MemoryBarrier(); } - assert( sqlite3GlobalConfig.mutex.xMutexInit ); - rc = sqlite3GlobalConfig.mutex.xMutexInit(); + if( !initPending ){ + assert( sqlite3GlobalConfig.mutex.xMutexInit ); + initPending = 1; + rc = sqlite3GlobalConfig.mutex.xMutexInit(); + initPending = 0; + } #ifdef SQLITE_DEBUG GLOBAL(int, mutexIsInit) = 1;