aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <Dan Kennedy>2025-06-12 07:35:38 +0000
committerdan <Dan Kennedy>2025-06-12 07:35:38 +0000
commit792d1d1b6d61453c4c4af6813f5877818f51a13c (patch)
tree6324de3499e440ba4084c7066895eb2f45e6375b /src
parent6a5e74cbf04e79dd7971e6dff723ef1499eddfe4 (diff)
downloadsqlite-792d1d1b6d61453c4c4af6813f5877818f51a13c.tar.gz
sqlite-792d1d1b6d61453c4c4af6813f5877818f51a13c.zip
Have sqlite3_setlk_timeout() take the database handle mutex. This fixes an assert() failure that could occur if sqlite3_setlk_timeout() were called on a threadsafe handle.
FossilOrigin-Name: a95d126e1330e1b83f42b51f97c4c216622cf38062f3b5d72ccb76313187e850
Diffstat (limited to 'src')
-rw-r--r--src/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 9b67de815..0dd9926fe 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1861,6 +1861,7 @@ int sqlite3_setlk_timeout(sqlite3 *db, int ms, int flags){
#endif
if( ms<-1 ) return SQLITE_RANGE;
#ifdef SQLITE_ENABLE_SETLK_TIMEOUT
+ sqlite3_mutex_enter(db->mutex);
db->setlkTimeout = ms;
db->setlkFlags = flags;
sqlite3BtreeEnterAll(db);
@@ -1872,6 +1873,7 @@ int sqlite3_setlk_timeout(sqlite3 *db, int ms, int flags){
}
}
sqlite3BtreeLeaveAll(db);
+ sqlite3_mutex_leave(db->mutex);
#endif
#if !defined(SQLITE_ENABLE_API_ARMOR) && !defined(SQLITE_ENABLE_SETLK_TIMEOUT)
UNUSED_PARAMETER(db);