aboutsummaryrefslogtreecommitdiff
path: root/ext/recover/sqlite3recover.c
diff options
context:
space:
mode:
authordrh <>2022-11-06 17:19:34 +0000
committerdrh <>2022-11-06 17:19:34 +0000
commitb819202acfdd1486cc12ef1f7b67eada454d7f18 (patch)
tree2d7d692d0f613115a3d5ea44cfa66f271bbfe5a9 /ext/recover/sqlite3recover.c
parentf53c0a0d4e02fbf7b536ba84eecb33ec7df6877f (diff)
downloadsqlite-b819202acfdd1486cc12ef1f7b67eada454d7f18.tar.gz
sqlite-b819202acfdd1486cc12ef1f7b67eada454d7f18.zip
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
Diffstat (limited to 'ext/recover/sqlite3recover.c')
-rw-r--r--ext/recover/sqlite3recover.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/recover/sqlite3recover.c b/ext/recover/sqlite3recover.c
index 1dd63fb3f..67c7aa4f2 100644
--- a/ext/recover/sqlite3recover.c
+++ b/ext/recover/sqlite3recover.c
@@ -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 */
-