Lines Matching full:mutex
696 ** This interface only reports on the compile-time mutex setting
1181 ** CAPI3REF: Mutex Handle
1183 ** The mutex module within SQLite defines [sqlite3_mutex] to be an
1184 ** abstract type for a mutex object. The SQLite core never looks
1219 ** or modify this field while holding a particular static mutex.
1398 ** as a mutex) it returns an [error code] other than [SQLITE_OK].
1554 ** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes
1558 ** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
1725 ** alternative low-level mutex routines to be used in place
1726 ** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the
1738 ** structure is filled with the currently defined mutex routines.)^
1739 ** This option can be used to overload the default mutex allocation
1740 ** routines with a wrapper used to track mutex usage for performance
3007 ** a mutex is held. A internal mutex is held for a protected
3008 ** sqlite3_value object but no mutex is held for an unprotected
3011 ** or if SQLite is run in one of reduced mutex modes
5142 ** of these mutex routines. An appropriate implementation
5160 ** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
5162 ** application must supply a custom mutex implementation using the
5168 ** mutex and returns a pointer to it. ^If it returns NULL
5169 ** that means that a mutex could not be allocated. ^SQLite
5186 ** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
5188 ** The mutex implementation does not need to make a distinction
5190 ** not want to. ^SQLite will only request a recursive mutex in
5191 ** cases where it really needs one. ^If a faster non-recursive mutex
5192 ** implementation is available on the host platform, the mutex subsystem
5193 ** might return such a mutex in response to SQLITE_MUTEX_FAST.
5197 ** a pointer to a static preexisting mutex. ^Six static mutexes are
5204 ** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
5206 ** returns a different mutex on every call. ^But for the static
5207 ** mutex types, the same mutex is returned on every call that has
5211 ** allocated dynamic mutex. ^SQLite is careful to deallocate every
5212 ** dynamic mutex that it allocates. The dynamic mutexes must not be in
5214 ** mutex results in undefined behavior. ^SQLite never deallocates
5215 ** a static mutex.
5218 ** to enter a mutex. ^If another thread is already within the mutex,
5224 ** mutex must be exited an equal number of times before another thread
5226 ** kind of mutex more than once, the behavior is undefined.
5235 ** ^The sqlite3_mutex_leave() routine exits a mutex that was
5237 ** is undefined if the mutex is not currently entered by the
5254 ** CAPI3REF: Mutex Methods Object
5260 ** Usually, the default mutex implementations provided by SQLite are
5267 ** output variable when querying the system for the current mutex
5278 ** resources obtained by the mutex methods implementation, especially
5298 ** of a valid mutex handle. The implementations of the methods defined
5300 ** of passing a NULL pointer instead of a valid mutex handle are undefined
5311 ** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
5312 ** memory allocation for a fast or recursive mutex.
5333 ** CAPI3REF: Mutex Verification Routines
5340 ** with the SQLITE_DEBUG flag. ^External mutex implementations
5344 ** ^These routines should return true if the mutex in their argument
5354 ** clearly the mutex cannot be held if it does not exist. But the
5355 ** the reason the mutex does not exist is because the build is not
5367 ** CAPI3REF: Mutex Types
5373 ** next. Applications that override the built-in mutex logic must be
5387 ** CAPI3REF: Retrieve the mutex for a database connection
5728 ** ^SQLite holds a [SQLITE_MUTEX_RECURSIVE] mutex when it invokes
6014 ** backup is in progress might also also cause a mutex deadlock.
6873 ** a mutex before we enter sqlite3VdbeExec(). The Btrees are
8095 /************** Include mutex.h in the middle of sqliteInt.h *****************/
8096 /************** Begin file mutex.h *******************************************/
8109 ** This file contains the common header for all mutex implementations.
8123 ** SQLITE_MUTEX_OMIT No mutex logic. Not even stubs. The
8169 /************** End of mutex.h ***********************************************/
8336 sqlite3_mutex *mutex; /* Connection mutex */
8400 ** mutex, not by sqlite3.mutex. They are used by code in notify.c.
8703 ** to avoid deadlock issues involving multiple sqlite3.mutex mutexes.
8706 ** list without holding the corresponding sqlite3.mutex mutex.
9883 sqlite3_mutex_methods mutex; /* Low-level mutex interface */
9903 sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */
10761 {0,0,0,0,0,0,0,0,0}, /* mutex */
12272 sqlite3_mutex *mutex;
12279 mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
12281 sqlite3_mutex_enter(mutex);
12286 sqlite3_mutex_leave(mutex);
12316 sqlite3_mutex *mutex = 0;
12321 mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
12322 sqlite3_mutex_enter(mutex);
12332 sqlite3_mutex_leave(mutex);
12341 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
12343 sqlite3_mutex_enter(mutex);
12345 sqlite3_mutex_leave(mutex);
12735 ** Mutex to control access to the memory allocation subsystem.
12737 sqlite3_mutex *mutex;
12843 ** hold the STATIC_MEM mutex when the routines here are invoked. */
12844 mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
12854 mem.mutex = 0;
12900 sqlite3_mutex_enter(mem.mutex);
12943 sqlite3_mutex_leave(mem.mutex);
12954 assert( sqlite3GlobalConfig.bMemstat || mem.mutex!=0 );
12958 sqlite3_mutex_enter(mem.mutex);
12979 sqlite3_mutex_leave(mem.mutex);
13046 sqlite3_mutex_enter(mem.mutex);
13051 sqlite3_mutex_leave(mem.mutex);
13235 ** Mutex to control access to the memory allocation subsystem.
13237 sqlite3_mutex *mutex;
13271 assert( sqlite3_mutex_held(mem3.mutex) );
13290 assert( sqlite3_mutex_held(mem3.mutex) );
13309 assert( sqlite3_mutex_held(mem3.mutex) );
13324 assert( sqlite3_mutex_held(mem3.mutex) );
13339 ** If the STATIC_MEM mutex is not already held, obtain it now. The mutex
13344 if( sqlite3GlobalConfig.bMemstat==0 && mem3.mutex==0 ){
13345 mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
13347 sqlite3_mutex_enter(mem3.mutex);
13350 sqlite3_mutex_leave(mem3.mutex);
13359 assert( sqlite3_mutex_held(mem3.mutex) );
13360 sqlite3_mutex_leave(mem3.mutex);
13362 sqlite3_mutex_enter(mem3.mutex);
13375 assert( sqlite3_mutex_held(mem3.mutex) );
13392 assert( sqlite3_mutex_held(mem3.mutex) );
13439 assert( sqlite3_mutex_held(mem3.mutex) );
13480 assert( sqlite3_mutex_held(mem3.mutex) );
13561 assert( sqlite3_mutex_held(mem3.mutex) );
13700 mem3.mutex = 0;
13772 sqlite3_mutex_leave(mem3.mutex);
13911 ** Mutex to control access to the memory allocation subsystem.
13913 sqlite3_mutex *mutex;
13981 assert( sqlite3_mutex_held(mem5.mutex) );
13996 ** If the STATIC_MEM mutex is not already held, obtain it now. The mutex
14001 sqlite3_mutex_enter(mem5.mutex);
14004 sqlite3_mutex_leave(mem5.mutex);
14047 ** The caller has obtained a mutex prior to invoking this
14262 ** This routine is not threadsafe. The caller must be holding a mutex
14274 /* For the purposes of this routine, disable the mutex */
14275 mem5.mutex = 0;
14311 /* If a mutex is required for normal operation, allocate one */
14313 mem5.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
14324 mem5.mutex = 0;
14393 /************** Begin file mutex.c *******************************************/
14407 ** This file contains code that is common across all mutex implementations.
14412 ** For debugging purposes, record when the mutex subsystem is initialized
14414 ** allocate a mutex while the system is uninitialized.
14422 ** Initialize the mutex system.
14427 if( !sqlite3GlobalConfig.mutex.xMutexAlloc ){
14429 ** install a mutex implementation via sqlite3_config() prior to
14434 sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;
14441 rc = sqlite3GlobalConfig.mutex.xMutexInit();
14452 ** Shutdown the mutex system. This call frees resources allocated by
14457 if( sqlite3GlobalConfig.mutex.xMutexEnd ){
14458 rc = sqlite3GlobalConfig.mutex.xMutexEnd();
14469 ** Retrieve a pointer to a static mutex or allocate a new dynamic one.
14475 return sqlite3GlobalConfig.mutex.xMutexAlloc(id);
14483 return sqlite3GlobalConfig.mutex.xMutexAlloc(id);
14487 ** Free a dynamic mutex.
14491 sqlite3GlobalConfig.mutex.xMutexFree(p);
14496 ** Obtain the mutex p. If some other thread already has the mutex, block
14501 sqlite3GlobalConfig.mutex.xMutexEnter(p);
14506 ** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another
14507 ** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY.
14512 return sqlite3GlobalConfig.mutex.xMutexTry(p);
14518 ** The sqlite3_mutex_leave() routine exits a mutex that was previously
14519 ** entered by the same thread. The behavior is undefined if the mutex
14525 sqlite3GlobalConfig.mutex.xMutexLeave(p);
14535 return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p);
14538 return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p);
14544 /************** End of mutex.c ***********************************************/
14563 ** mutex routines at start-time using the
14577 ** Stub routines for all mutex methods.
14617 ** The mutex object
14620 int id; /* The mutex type */
14636 ** Initialize and deinitialize the mutex subsystem.
14643 ** mutex and returns a pointer to it. If it returns NULL
14644 ** that means that a mutex could not be allocated.
14671 ** This routine deallocates a previously allocated mutex.
14681 ** to enter a mutex. If another thread is already within the mutex,
14686 ** mutex must be exited an equal number of times before another thread
14687 ** can enter. If the same thread tries to enter any other kind of mutex
14701 ** The sqlite3_mutex_leave() routine exits a mutex that was
14703 ** is undefined if the mutex is not currently entered or
14748 ** See the mutex.h file for details.
14752 /********************** OS/2 Mutex Implementation **********************
14758 ** The mutex object
14759 ** Each recursive mutex is an instance of the following structure.
14762 HMTX mutex; /* Mutex controlling the lock */
14763 int id; /* Mutex type */
14765 TID owner; /* Thread holding this mutex */
14771 ** Initialize and deinitialize the mutex subsystem.
14778 ** mutex and returns a pointer to it. If it returns NULL
14779 ** that means that a mutex could not be allocated.
14792 ** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
14794 ** The mutex implementation does not need to make a distinction
14796 ** not want to. But SQLite will only request a recursive mutex in
14797 ** cases where it really needs one. If a faster non-recursive mutex
14798 ** implementation is available on the host platform, the mutex subsystem
14799 ** might return such a mutex in response to SQLITE_MUTEX_FAST.
14802 ** a pointer to a static preexisting mutex. Three static mutexes are
14809 ** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
14811 ** returns a different mutex on every call. But for the static
14812 ** mutex types, the same mutex is returned on every call that has
14823 if( DosCreateMutexSem( 0, &p->mutex, 0, FALSE ) != NO_ERROR ){
14844 HMTX mutex;
14850 mutex = 0;
14851 rc = DosCreateMutexSem( name, &mutex, 0, FALSE);
14856 DosCreateMutexSem( 0, &staticMutexes[i].mutex, 0, FALSE );
14860 DosCloseMutexSem( mutex );
14880 ** This routine deallocates a previously allocated mutex.
14881 ** SQLite is careful to deallocate every mutex that it allocates.
14887 DosCloseMutexSem( p->mutex );
14902 DosQueryMutexSem(p->mutex, &pid, &tid, &ulCount);
14915 DosQueryMutexSem(p->mutex, &pid, &tid, &ulCount);
14926 ** to enter a mutex. If another thread is already within the mutex,
14931 ** mutex must be exited an equal number of times before another thread
14932 ** can enter. If the same thread tries to enter any other kind of mutex
14941 DosRequestMutexSem(p->mutex, SEM_INDEFINITE_WAIT);
14942 DosQueryMutexSem(p->mutex, &holder1, &tid, &holder2);
14953 if( DosRequestMutexSem(p->mutex, SEM_IMMEDIATE_RETURN) == NO_ERROR) {
14954 DosQueryMutexSem(p->mutex, &holder1, &tid, &holder2);
14966 ** The sqlite3_mutex_leave() routine exits a mutex that was
14968 ** is undefined if the mutex is not currently entered or
14977 DosQueryMutexSem(p->mutex, &holder1, &tid, &holder2);
14981 DosReleaseMutexSem(p->mutex);
15032 ** Each recursive mutex is an instance of the following structure.
15035 pthread_mutex_t mutex; /* Mutex controlling the lock */
15036 int id; /* Mutex type */
15038 pthread_t owner; /* Thread that is within this mutex */
15075 ** Initialize and deinitialize the mutex subsystem.
15082 ** mutex and returns a pointer to it. If it returns NULL
15083 ** that means that a mutex could not be allocated. SQLite
15099 ** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
15101 ** The mutex implementation does not need to make a distinction
15103 ** not want to. But SQLite will only request a recursive mutex in
15104 ** cases where it really needs one. If a faster non-recursive mutex
15105 ** implementation is available on the host platform, the mutex subsystem
15106 ** might return such a mutex in response to SQLITE_MUTEX_FAST.
15109 ** a pointer to a static preexisting mutex. Six static mutexes are
15116 ** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
15118 ** returns a different mutex on every call. But for the static
15119 ** mutex types, the same mutex is returned on every call that has
15139 pthread_mutex_init(&p->mutex, 0);
15141 /* Use a recursive mutex if it is available */
15145 pthread_mutex_init(&p->mutex, &recursiveAttr);
15156 pthread_mutex_init(&p->mutex, 0);
15174 ** allocated mutex. SQLite is careful to deallocate every
15175 ** mutex that it allocates.
15180 pthread_mutex_destroy(&p->mutex);
15186 ** to enter a mutex. If another thread is already within the mutex,
15191 ** mutex must be exited an equal number of times before another thread
15192 ** can enter. If the same thread tries to enter any other kind of mutex
15214 pthread_mutex_lock(&p->mutex);
15223 pthread_mutex_lock(&p->mutex);
15230 printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
15254 }else if( pthread_mutex_trylock(&p->mutex)==0 ){
15266 if( pthread_mutex_trylock(&p->mutex)==0 ){
15277 printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
15284 ** The sqlite3_mutex_leave() routine exits a mutex that was
15286 ** is undefined if the mutex is not currently entered or
15296 pthread_mutex_unlock(&p->mutex);
15299 pthread_mutex_unlock(&p->mutex);
15304 printf("leave mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
15355 ** Each recursive mutex is an instance of the following structure.
15358 CRITICAL_SECTION mutex; /* Mutex controlling the lock */
15359 int id; /* Mutex type */
15361 DWORD owner; /* Thread holding this mutex */
15413 ** Initialize and deinitialize the mutex subsystem.
15429 InitializeCriticalSection(&winMutex_staticMutexes[i].mutex);
15448 DeleteCriticalSection(&winMutex_staticMutexes[i].mutex);
15458 ** mutex and returns a pointer to it. If it returns NULL
15459 ** that means that a mutex could not be allocated. SQLite
15475 ** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
15477 ** The mutex implementation does not need to make a distinction
15479 ** not want to. But SQLite will only request a recursive mutex in
15480 ** cases where it really needs one. If a faster non-recursive mutex
15481 ** implementation is available on the host platform, the mutex subsystem
15482 ** might return such a mutex in response to SQLITE_MUTEX_FAST.
15485 ** a pointer to a static preexisting mutex. Six static mutexes are
15492 ** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
15494 ** returns a different mutex on every call. But for the static
15495 ** mutex types, the same mutex is returned on every call that has
15507 InitializeCriticalSection(&p->mutex);
15526 ** allocated mutex. SQLite is careful to deallocate every
15527 ** mutex that it allocates.
15533 DeleteCriticalSection(&p->mutex);
15539 ** to enter a mutex. If another thread is already within the mutex,
15544 ** mutex must be exited an equal number of times before another thread
15545 ** can enter. If the same thread tries to enter any other kind of mutex
15550 EnterCriticalSection(&p->mutex);
15569 if( mutexIsNT() && TryEnterCriticalSection(&p->mutex) ){
15581 ** The sqlite3_mutex_leave() routine exits a mutex that was
15583 ** is undefined if the mutex is not currently entered or
15591 LeaveCriticalSection(&p->mutex);
15697 sqlite3_mutex *mutex; /* Mutex to serialize access */
15700 ** The alarm callback and its arguments. The mem0.mutex lock will
15729 mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
15804 sqlite3_mutex_enter(mem0.mutex);
15808 sqlite3_mutex_leave(mem0.mutex);
15838 sqlite3_mutex_leave(mem0.mutex);
15840 sqlite3_mutex_enter(mem0.mutex);
15852 assert( sqlite3_mutex_held(mem0.mutex) );
15888 sqlite3_mutex_enter(mem0.mutex);
15890 sqlite3_mutex_leave(mem0.mutex);
15943 sqlite3_mutex_enter(mem0.mutex);
15945 sqlite3_mutex_leave(mem0.mutex);
15953 sqlite3_mutex_leave(mem0.mutex);
15966 sqlite3_mutex_enter(mem0.mutex);
15970 sqlite3_mutex_leave(mem0.mutex);
15996 sqlite3_mutex_enter(mem0.mutex);
16000 sqlite3_mutex_leave(mem0.mutex);
16009 sqlite3_mutex_enter(mem0.mutex);
16013 sqlite3_mutex_leave(mem0.mutex);
16037 assert( db==0 || sqlite3_mutex_held(db->mutex) );
16051 sqlite3_mutex_enter(mem0.mutex);
16054 sqlite3_mutex_leave(mem0.mutex);
16065 assert( db==0 || sqlite3_mutex_held(db->mutex) );
16098 sqlite3_mutex_enter(mem0.mutex);
16113 sqlite3_mutex_leave(mem0.mutex);
16175 assert( db==0 || sqlite3_mutex_held(db->mutex) );
16211 assert( sqlite3_mutex_held(db->mutex) );
16315 ** mutex here. Otherwise the read (and possible write) of db->mallocFailed
16318 assert( !db || sqlite3_mutex_held(db->mutex) );
17274 ** mutex is held.
17367 ** Get a single 8-bit random value from the RC4 PRNG. The Mutex
17444 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
17446 sqlite3_mutex_enter(mutex);
17450 sqlite3_mutex_leave(mutex);
18112 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
21787 ** Helper functions to obtain and relinquish the global mutex. The
21788 ** global mutex is used to protect the unixOpenCnt, unixLockInfo and
21792 ** Function unixMutexHeld() is used to assert() that the global mutex
22391 ** The mutex entered using the unixEnterMutex() function must be held
22418 ** The mutex entered using the unixEnterMutex() function must be held
22458 ** The mutex entered using the unixEnterMutex() function must be held
22827 /* This mutex is needed because pFile->pLock is shared across threads
23162 ** It is *not* necessary to hold the mutex when this routine is called,
23163 ** even on VxWorks. A mutex will be acquired on VxWorks by the
24023 /* This mutex is needed because pFile->pLock is shared across threads
25076 ** immediately, before releasing the mutex. findLockInfo() may fail
27000 ** single thread. The memory allocation and mutex subsystems have not
27423 HANDLE hMutex; /* Mutex used to control access to shared lock */
27664 ** Create the mutex and shared memory used for locking in the file
27676 ** to derive a mutex name. */
27682 /* Create/open the named mutex */
27690 /* Acquire the mutex before continuing */
27694 ** case-sensitive, take advantage of that by uppercasing the mutex name
27722 /* If shared memory could not be created, then close the mutex and fail */
27744 /* Acquire the mutex */
27766 /* Done with the mutex */
30264 ** The global mutex must be held when accessing nMax.
30272 ** when the accessor is holding the global mutex (see pcache1EnterMutex()
30309 sqlite3_mutex *mutex; /* static mutex MUTEX_STATIC_LRU */
30346 ** Macros to enter and leave the global LRU mutex.
30348 #define pcache1EnterMutex() sqlite3_mutex_enter(pcache1.mutex)
30349 #define pcache1LeaveMutex() sqlite3_mutex_leave(pcache1.mutex)
30385 assert( sqlite3_mutex_held(pcache1.mutex) );
30395 ** global pcache mutex and unlock the pager-cache object pCache. This is
30415 assert( sqlite3_mutex_held(pcache1.mutex) );
30493 ** The global mutex must be held when this function is called.
30500 assert( sqlite3_mutex_held(pcache1.mutex) );
30537 ** The global mutex must be held when this function is called.
30540 assert( sqlite3_mutex_held(pcache1.mutex) );
30565 ** The global mutex must be held when this function is called.
30584 assert( sqlite3_mutex_held(pcache1.mutex) );
30598 ** The global mutex must be held when this function is called.
30606 assert( sqlite3_mutex_held(pcache1.mutex) );
30636 mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_LRU);
30644 ** Note that the static mutex allocated in xInit does
37069 ** Access to all fields of this structure is controlled by the mutex
37070 ** stored in MemPage.pBt->mutex.
37136 ** All fields in this structure are accessed under sqlite3.mutex.
37140 ** they often do so without holding sqlite3.mutex.
37178 ** Fields in this structure are accessed under the BtShared.mutex
37179 ** mutex, except for nRef and pNext which are accessed under the
37180 ** global SQLITE_MUTEX_STATIC_MASTER mutex. The pPager field
37182 ** The pSchema field may be set once under BtShared.mutex and
37224 sqlite3_mutex *mutex; /* Non-recursive mutex required to access this struct */
37276 ** Fields in this structure are accessed under the BtShared.mutex
37277 ** found at self->pBt->mutex.
37446 ** Obtain the BtShared mutex associated with B-Tree handle p. Also,
37452 assert( sqlite3_mutex_notheld(p->pBt->mutex) );
37453 assert( sqlite3_mutex_held(p->db->mutex) );
37455 sqlite3_mutex_enter(p->pBt->mutex);
37461 ** Release the BtShared mutex associated with B-Tree handle p and
37466 assert( sqlite3_mutex_held(p->pBt->mutex) );
37467 assert( sqlite3_mutex_held(p->db->mutex) );
37470 sqlite3_mutex_leave(p->pBt->mutex);
37475 ** Enter a mutex on the given BTree object.
37477 mutex is ever required
37478 ** and this routine is a no-op. The underlying mutex is non-recursive.
37508 assert( sqlite3_mutex_held(p->db->mutex) );
37522 if( sqlite3_mutex_try(p->pBt->mutex)==SQLITE_OK ){
37550 ** Exit the recursive mutex on a Btree.
37564 ** Return true if the BtShared mutex is held on the btree, or if the
37572 assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->pBt->mutex) );
37573 assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->db->mutex) );
37582 ** Enter and leave a mutex on a Btree given a cursor owned by that
37596 ** Enter the mutex on every Btree associated with a database
37612 assert( sqlite3_mutex_held(db->mutex) );
37640 assert( sqlite3_mutex_held(db->mutex) );
37656 ** mutex and all required BtShared mutexes.
37662 if( !sqlite3_mutex_held(db->mutex) ){
37669 (p->wantToLock==0 || !sqlite3_mutex_held(p->pBt->mutex)) ){
37719 ** Enter the mutex of every btree in the array. This routine is
37732 assert( sqlite3_mutex_held(p->db->mutex) );
37746 ** Leave the mutex of every btree in the group.
37758 assert( sqlite3_mutex_held(p->db->mutex) );
38198 ** Verify that the cursor holds the mutex on its BtShared
38202 return sqlite3_mutex_held(p->pBt->mutex);
38223 assert( sqlite3_mutex_held(pBt->mutex) );
38397 assert( sqlite3_mutex_held(pBt->mutex) );
38514 assert( sqlite3_mutex_held(pBt->mutex) );
38543 assert( sqlite3_mutex_held(pBt->mutex) );
38592 assert( sqlite3_mutex_held(pBt->mutex) );
38633 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
38666 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
38851 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
38933 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
39030 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
39118 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
39151 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
39268 assert( sqlite3_mutex_held(pBt->mutex) );
39323 assert( sqlite3_mutex_held(pBt->mutex) );
39337 assert( sqlite3_mutex_held(pBt->mutex) );
39373 assert( sqlite3_mutex_held(pBt->mutex) );
39404 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
39422 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
39442 assert( sqlite3_mutex_held(pBt->db->mutex) );
39490 assert( sqlite3_mutex_held(db->mutex) );
39629 pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST);
39630 if( pBt->mutex==0 ){
39705 assert( sqlite3_mutex_notheld(pBt->mutex) );
39722 sqlite3_mutex_free(pBt->mutex);
39759 assert( sqlite3_mutex_held(p->db->mutex) );
39784 ** it without having to hold the mutex.
39826 assert( sqlite3_mutex_held(p->db->mutex) );
39844 assert( sqlite3_mutex_held(p->db->mutex) );
39859 assert( sqlite3_mutex_held(p->db->mutex) );
40010 assert( sqlite3_mutex_held(pBt->mutex) );
40122 assert( sqlite3_mutex_held(pBt->mutex) );
40144 assert( sqlite3_mutex_held(pBt->mutex) );
40344 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
40387 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
40460 assert( sqlite3_mutex_held(pBt->mutex) );
40542 assert( sqlite3_mutex_held(pBt->mutex) );
40677 assert( sqlite3_mutex_held(pBt->mutex) );
41358 assert( sqlite3_mutex_held(pBt->mutex) );
41711 ** Hence, a mutex on the BtShared should be held prior to calling
41719 assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
41728 assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
41966 assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
41990 assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
42060 assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
42407 assert( sqlite3_mutex_held(pBt->mutex) );
42679 assert( sqlite3_mutex_held(pBt->mutex) );
42812 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
42878 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
43028 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
43094 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
43171 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
43239 assert( sqlite3_mutex_held(pPage->pBt->mutex) );
43488 assert( sqlite3_mutex_held(pBt->mutex) );
44080 assert( sqlite3_mutex_held(pBt->mutex) );
44672 assert( sqlite3_mutex_held(pBt->mutex) );
45515 ** open so it is safe to access without the BtShared mutex.
45528 ** open so it is safe to access without the BtShared mutex.
45539 assert( p==0 || sqlite3_mutex_held(p->db->mutex) );
45548 assert( sqlite3_mutex_held(p->db->mutex) );
45554 assert( sqlite3_mutex_held(p->db->mutex) );
45596 assert( sqlite3_mutex_held(p->db->mutex) );
45644 assert( sqlite3_mutex_held(pCsr->pBtree->db->mutex) );
45686 assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
45749 ** handle mutex and the mutex associated with the source BtShared
45754 ** the page cache associated with the source database. The mutex
45836 sqlite3_mutex_enter(pSrcDb->mutex);
45837 sqlite3_mutex_enter(pDestDb->mutex);
45875 sqlite3_mutex_leave(pDestDb->mutex);
45876 sqlite3_mutex_leave(pSrcDb->mutex);
45983 sqlite3_mutex_enter(p->pSrcDb->mutex);
45986 sqlite3_mutex_enter(p->pDestDb->mutex);
46156 sqlite3_mutex_leave(p->pDestDb->mutex);
46159 sqlite3_mutex_leave(p->pSrcDb->mutex);
46168 sqlite3_mutex *mutex; /* Mutex to protect source database */
46173 sqlite3_mutex_enter(p->pSrcDb->mutex);
46175 mutex = p->pSrcDb->mutex;
46177 sqlite3_mutex_enter(p->pDestDb->mutex);
46201 sqlite3_mutex_leave(p->pDestDb->mutex);
46207 sqlite3_mutex_leave(mutex);
46235 ** It is assumed that the mutex associated with the BtShared object
46242 assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );
46264 ** It is assumed that the mutex associated with the BtShared object
46271 assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) );
46369 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46445 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46471 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46495 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46526 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46570 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46591 assert( p->db==0 || sqlite3_mutex_held(p->db->mutex) );
46675 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46704 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46735 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46762 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46776 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46793 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
46957 assert( pFrom->db==0 || sqlite3_mutex_held(pFrom->db->mutex) );
46958 assert( pTo->db==0 || sqlite3_mutex_held(pTo->db->mutex) );
46994 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
47255 assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );
49375 ** this routine obtains the mutex associated with each BtShared structure
50461 assert( sqlite3_mutex_held(db->mutex) );
50609 sqlite3_mutex *mutex;
50613 mutex = v->db->mutex;
50615 sqlite3_mutex_enter(mutex);
50618 sqlite3_mutex_leave(mutex);
50637 sqlite3_mutex_enter(v->db->mutex);
50642 sqlite3_mutex_leave(v->db->mutex);
50655 sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;
50657 sqlite3_mutex_enter(mutex);
50665 sqlite3_mutex_leave(mutex);
50744 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50748 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50752 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50758 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50764 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50768 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50772 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50781 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50791 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50800 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50809 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50814 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50818 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50831 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50839 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
50966 sqlite3_mutex_enter(db->mutex);
50993 sqlite3_mutex_leave(db->mutex);
51045 assert( sqlite3_mutex_held(p->s.db->mutex) );
51072 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
51095 assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
51172 sqlite3_mutex_enter(pVm->db->mutex);
51194 sqlite3_mutex_enter(pVm->db->mutex);
51231 sqlite3_mutex_leave(p->db->mutex);
51339 sqlite3_mutex_enter(db->mutex);
51349 sqlite3_mutex_leave(db->mutex);
51455 ** A successful evaluation of this routine acquires the mutex on p.
51456 ** the mutex is released if any kind of error occurs.
51466 sqlite3_mutex_enter(p->db->mutex);
51469 sqlite3_mutex_leave(p->db->mutex);
51476 sqlite3_mutex_leave(p->db->mutex);
51522 sqlite3_mutex_leave(p->db->mutex);
51546 sqlite3_mutex_leave(p->db->mutex);
51559 sqlite3_mutex_leave(p->db->mutex);
51568 sqlite3_mutex_leave(p->db->mutex);
51629 sqlite3_mutex_leave(p->db->mutex);
51652 sqlite3_mutex_enter(p->db->mutex);
51665 sqlite3_mutex_leave(p->db->mutex);
51718 sqlite3_mutex_enter(pTo->db->mutex);
51722 sqlite3_mutex_leave(pTo->db->mutex);
51773 sqlite3_mutex_enter(pDb->mutex);
51779 sqlite3_mutex_leave(pDb->mutex);
57065 ** Although the mutex on the BtShared object that corresponds to
57072 ** u.bu.iDb mutex may be temporarily released to avoid deadlock. If
58386 sqlite3_mutex_enter(db->mutex);
58488 /* Make sure a mutex is held on the table to be accessed */
58579 sqlite3_mutex_leave(db->mutex);
58594 sqlite3_mutex_enter(db->mutex);
58597 sqlite3_mutex_leave(db->mutex);
58621 sqlite3_mutex_enter(db->mutex);
58650 sqlite3_mutex_leave(db->mutex);
58672 ** so no mutex is required for access.
66307 sqlite3_mutex_enter(db->mutex);
66311 sqlite3_mutex_leave(db->mutex);
75859 sqlite3_mutex_enter(db->mutex);
75955 sqlite3_mutex_leave(db->mutex);
76774 sqlite3_mutex_enter(db->mutex);
76777 sqlite3_mutex_leave(db->mutex);
76787 assert( sqlite3_mutex_held(db->mutex) );
76799 sqlite3_mutex_enter(db->mutex);
76805 sqlite3_mutex_leave(db->mutex);
76827 ** mutex must be held while accessing this list.
76866 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
76869 sqlite3_mutex_enter(mutex);
76885 sqlite3_mutex_leave(mutex);
76900 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
76903 sqlite3_mutex_enter(mutex);
76907 sqlite3_mutex_leave(mutex);
76923 /* Common case: early out without every having to acquire a mutex */
76929 sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
76931 sqlite3_mutex_enter(mutex);
76939 sqlite3_mutex_leave(mutex);
78441 assert( sqlite3_mutex_held(db->mutex) );
78554 assert( sqlite3_mutex_held(db->mutex) );
78767 assert( sqlite3_mutex_held(db->mutex) );
78807 assert( sqlite3_mutex_held(db->mutex) );
78831 assert( sqlite3_mutex_held(db->mutex) );
78884 assert( sqlite3_mutex_held(db->mutex) );
78922 assert( sqlite3_mutex_held(db->mutex) );
79076 sqlite3_mutex_enter(db->mutex);
79084 sqlite3_mutex_leave(db->mutex);
79102 assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) );
79106 assert( sqlite3_mutex_held(db->mutex) );
79184 sqlite3_mutex_enter(db->mutex);
79201 sqlite3_mutex_leave(db->mutex);
85844 sqlite3_mutex_enter(db->mutex);
85868 sqlite3_mutex_leave(db->mutex);
85956 /* Assert that the mutex (if any) associated with the BtShared database
85993 ** 1) By this function. In this case, all BtShared mutexes and the mutex
85997 ** the sqlite3.pDisconnect list. In this case either the BtShared mutex
86000 ** the database handle mutex is held.
86010 assert( sqlite3_mutex_held(db->mutex) );
86457 sqlite3_mutex_enter(db->mutex);
86461 sqlite3_mutex_leave(db->mutex);
86502 sqlite3_mutex_leave(db->mutex);
95519 ** VFS, and mutex subsystems prior to doing any serious work with
95547 sqlite3_mutex *pMaster; /* The main static mutex */
95564 /* Make sure the mutex subsystem is initialized. If unable to
95565 ** initialize the mutex subsystem, return early with the error.
95566 ** If the system is so sick that we are unable to allocate a mutex,
95569 ** The mutex subsystem must take care of serializing its own
95575 /* Initialize the malloc() system and the recursive pInitMutex mutex.
95576 ** This operation is protected by the STATIC_MASTER mutex. Note that
95577 ** MutexAlloc() is called for a static mutex prior to initializing the
95579 ** mutex must not require support from the malloc subsystem.
95604 ** the pInitMutex mutex. Return an error in either case. */
95609 /* Do the rest of the initialization under the recursive mutex so
95637 /* Go back under the static mutex and clean up the recursive
95638 ** mutex to prevent a resource leak.
95721 /* Mutex configuration options are only available in a threadsafe
95745 /* Specify an alternative mutex implementation */
95746 sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*);
95750 /* Retrieve the current mutex implementation */
95751 *va_arg(ap, sqlite3_mutex_methods*) = sqlite3GlobalConfig.mutex;
95922 ** Return the mutex associated with a database connection.
95925 return db->mutex;
96062 sqlite3_mutex_enter(db->mutex);
96079 sqlite3_mutex_leave(db->mutex);
96089 sqlite3_mutex_leave(db->mutex);
96164 sqlite3_mutex_leave(db->mutex);
96166 sqlite3_mutex_free(db->mutex);
96181 assert( sqlite3_mutex_held(db->mutex) );
96324 sqlite3_mutex_enter(db->mutex);
96328 sqlite3_mutex_leave(db->mutex);
96344 sqlite3_mutex_enter(db->mutex);
96354 sqlite3_mutex_leave(db->mutex);
96400 assert( sqlite3_mutex_held(db->mutex) );
96482 sqlite3_mutex_enter(db->mutex);
96485 sqlite3_mutex_leave(db->mutex);
96502 sqlite3_mutex_enter(db->mutex);
96508 sqlite3_mutex_leave(db->mutex);
96533 sqlite3_mutex_enter(db->mutex);
96539 sqlite3_mutex_leave(db->mutex);
96554 sqlite3_mutex_enter(db->mutex);
96558 sqlite3_mutex_leave(db->mutex);
96575 sqlite3_mutex_enter(db->mutex);
96579 sqlite3_mutex_leave(db->mutex);
96596 sqlite3_mutex_enter(db->mutex);
96600 sqlite3_mutex_leave(db->mutex);
96614 sqlite3_mutex_enter(db->mutex);
96618 sqlite3_mutex_leave(db->mutex);
96632 sqlite3_mutex_enter(db->mutex);
96636 sqlite3_mutex_leave(db->mutex);
96698 assert( sqlite3_mutex_held(db->mutex) );
96740 sqlite3_mutex_enter(db->mutex);
96750 sqlite3_mutex_leave(db->mutex);
96779 sqlite3_mutex_enter(db->mutex);
96796 sqlite3_mutex_leave(db->mutex);
96841 assert( sqlite3_mutex_held(db->mutex) );
97044 db->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);
97045 if( db->mutex==0 ){
97051 sqlite3_mutex_enter(db->mutex);
97223 assert( db->mutex!=0 || isThreadsafe==0 || sqlite3GlobalConfig.bFullMutex==0 );
97224 sqlite3_mutex_leave(db->mutex);
97305 sqlite3_mutex_enter(db->mutex);
97309 sqlite3_mutex_leave(db->mutex);
97325 sqlite3_mutex_enter(db->mutex);
97329 sqlite3_mutex_leave(db->mutex);
97346 sqlite3_mutex_enter(db->mutex);
97354 sqlite3_mutex_leave(db->mutex);
97368 sqlite3_mutex_enter(db->mutex);
97372 sqlite3_mutex_leave(db->mutex);
97386 sqlite3_mutex_enter(db->mutex);
97390 sqlite3_mutex_leave(db->mutex);
97489 sqlite3_mutex_enter(db->mutex);
97568 sqlite3_mutex_leave(db->mutex);
97593 sqlite3_mutex_enter(db->mutex);
97595 sqlite3_mutex_leave(db->mutex);
97605 sqlite3_mutex_enter(db->mutex);
97629 sqlite3_mutex_leave(db->mutex);
97781 sqlite3_mutex_enter(db->mutex);
97783 sqlite3_mutex_leave(db->mutex);
97864 ** mutex is held.
97937 ** Obtain the STATIC_MASTER mutex.
97945 ** Release the STATIC_MASTER mutex.
97981 sqlite3_mutex_enter(db->mutex);
98013 sqlite3_mutex_leave(db->mutex);
98060 enterMutex(); /* Enter STATIC_MASTER mutex */
98143 leaveMutex(); /* Leave STATIC_MASTER mutex */
111168 sqlite3_mutex_enter(db->mutex);
111174 sqlite3_mutex_leave(db->mutex);