1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

The recoverAssertMutexHeld() function is for testing and verification only

and should be a harmless no-op for production builds.
[forum/forumpost/b4f2c7d402|Forum post b4f2c7d402].

FossilOrigin-Name: d75504710c86af0037ac897106aadffe54955463195ee4dfb2cdfc81d396cbb4
This commit is contained in:
drh
2022-11-06 17:19:34 +00:00
parent f53c0a0d4e
commit b819202acf
3 changed files with 19 additions and 10 deletions

View File

@ -282,10 +282,16 @@ static RecoverGlobal recover_g;
*/
#define RECOVER_ROWID_DEFAULT 1
/*
** Mutex handling:
**
** recoverEnterMutex() - Enter the recovery mutex
** recoverLeaveMutex() - Leave the recovery mutex
** recoverAssertMutexHeld() - Assert that the recovery mutex is held
*/
#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE==0
# define recoverEnterMutex()
# define recoverLeaveMutex()
# define recoverAssertMutexHeld()
#else
static void recoverEnterMutex(void){
sqlite3_mutex_enter(sqlite3_mutex_alloc(RECOVER_MUTEX_ID));
@ -293,9 +299,13 @@ static void recoverEnterMutex(void){
static void recoverLeaveMutex(void){
sqlite3_mutex_leave(sqlite3_mutex_alloc(RECOVER_MUTEX_ID));
}
#endif
#if SQLITE_THREADSAFE+0>=1 && defined(SQLITE_DEBUG)
static void recoverAssertMutexHeld(void){
assert( sqlite3_mutex_held(sqlite3_mutex_alloc(RECOVER_MUTEX_ID)) );
}
#else
# define recoverAssertMutexHeld()
#endif
@ -2848,4 +2858,3 @@ int sqlite3_recover_finish(sqlite3_recover *p){
}
#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */