| Index: third_party/sqlite/src/src/btmutex.c
|
| diff --git a/third_party/sqlite/src/src/btmutex.c b/third_party/sqlite/src/src/btmutex.c
|
| index c9c8572dfb2544616f576f33bbf0b15631f54fce..ddffb67fa4ecf774d5da8400fa3763c5bdabff64 100644
|
| --- a/third_party/sqlite/src/src/btmutex.c
|
| +++ b/third_party/sqlite/src/src/btmutex.c
|
| @@ -169,21 +169,6 @@ int sqlite3BtreeHoldsMutex(Btree *p){
|
| #endif
|
|
|
|
|
| -#ifndef SQLITE_OMIT_INCRBLOB
|
| -/*
|
| -** Enter and leave a mutex on a Btree given a cursor owned by that
|
| -** Btree. These entry points are used by incremental I/O and can be
|
| -** omitted if that module is not used.
|
| -*/
|
| -void sqlite3BtreeEnterCursor(BtCursor *pCur){
|
| - sqlite3BtreeEnter(pCur->pBtree);
|
| -}
|
| -void sqlite3BtreeLeaveCursor(BtCursor *pCur){
|
| - sqlite3BtreeLeave(pCur->pBtree);
|
| -}
|
| -#endif /* SQLITE_OMIT_INCRBLOB */
|
| -
|
| -
|
| /*
|
| ** Enter the mutex on every Btree associated with a database
|
| ** connection. This is needed (for example) prior to parsing
|
| @@ -198,16 +183,24 @@ void sqlite3BtreeLeaveCursor(BtCursor *pCur){
|
| ** two or more btrees in common both try to lock all their btrees
|
| ** at the same instant.
|
| */
|
| -void sqlite3BtreeEnterAll(sqlite3 *db){
|
| +static void SQLITE_NOINLINE btreeEnterAll(sqlite3 *db){
|
| int i;
|
| + int skipOk = 1;
|
| Btree *p;
|
| assert( sqlite3_mutex_held(db->mutex) );
|
| for(i=0; i<db->nDb; i++){
|
| p = db->aDb[i].pBt;
|
| - if( p ) sqlite3BtreeEnter(p);
|
| + if( p && p->sharable ){
|
| + sqlite3BtreeEnter(p);
|
| + skipOk = 0;
|
| + }
|
| }
|
| + db->skipBtreeMutex = skipOk;
|
| }
|
| -void sqlite3BtreeLeaveAll(sqlite3 *db){
|
| +void sqlite3BtreeEnterAll(sqlite3 *db){
|
| + if( db->skipBtreeMutex==0 ) btreeEnterAll(db);
|
| +}
|
| +static void SQLITE_NOINLINE btreeLeaveAll(sqlite3 *db){
|
| int i;
|
| Btree *p;
|
| assert( sqlite3_mutex_held(db->mutex) );
|
| @@ -216,13 +209,8 @@ void sqlite3BtreeLeaveAll(sqlite3 *db){
|
| if( p ) sqlite3BtreeLeave(p);
|
| }
|
| }
|
| -
|
| -/*
|
| -** Return true if a particular Btree requires a lock. Return FALSE if
|
| -** no lock is ever required since it is not sharable.
|
| -*/
|
| -int sqlite3BtreeSharable(Btree *p){
|
| - return p->sharable;
|
| +void sqlite3BtreeLeaveAll(sqlite3 *db){
|
| + if( db->skipBtreeMutex==0 ) btreeLeaveAll(db);
|
| }
|
|
|
| #ifndef NDEBUG
|
| @@ -298,4 +286,23 @@ void sqlite3BtreeEnterAll(sqlite3 *db){
|
| }
|
| }
|
| #endif /* if SQLITE_THREADSAFE */
|
| +
|
| +#ifndef SQLITE_OMIT_INCRBLOB
|
| +/*
|
| +** Enter a mutex on a Btree given a cursor owned by that Btree.
|
| +**
|
| +** These entry points are used by incremental I/O only. Enter() is required
|
| +** any time OMIT_SHARED_CACHE is not defined, regardless of whether or not
|
| +** the build is threadsafe. Leave() is only required by threadsafe builds.
|
| +*/
|
| +void sqlite3BtreeEnterCursor(BtCursor *pCur){
|
| + sqlite3BtreeEnter(pCur->pBtree);
|
| +}
|
| +# if SQLITE_THREADSAFE
|
| +void sqlite3BtreeLeaveCursor(BtCursor *pCur){
|
| + sqlite3BtreeLeave(pCur->pBtree);
|
| +}
|
| +# endif
|
| +#endif /* ifndef SQLITE_OMIT_INCRBLOB */
|
| +
|
| #endif /* ifndef SQLITE_OMIT_SHARED_CACHE */
|
|
|