diff --git a/GRDB/Core/Database.swift b/GRDB/Core/Database.swift index 7fb064346..12c8bf5d9 100644 --- a/GRDB/Core/Database.swift +++ b/GRDB/Core/Database.swift @@ -631,9 +631,17 @@ public final class Database { // MARK: - Lock Prevention - /// Release any database lock, as soon as possible, at any cost. + /// Starts preventing database locks. /// - /// See https://www.sqlite.org/lockingv3.html + /// This method can be called from any thread. + /// + /// During lock prevention, any lock is released as soon as possible, and + /// lock acquisition is prevented. + /// + /// All database accesses may throw a DatabaseError of code + /// `SQLITE_INTERRUPT`, or `SQLITE_ABORT`, except reads in WAL mode. + /// + /// Lock prevention ends with stopPreventingLock(). func startPreventingLock() { preventsLock.write { preventsLock in if preventsLock { @@ -667,6 +675,9 @@ public final class Database { } } + /// Ends lock prevention. See startPreventingLock(). + /// + /// This method can be called from any thread. func stopPreventingLock() { preventsLock.write { preventsLock in preventsLock = false diff --git a/GRDB/Core/DatabaseReader.swift b/GRDB/Core/DatabaseReader.swift index e6cdc49f3..62cce6195 100644 --- a/GRDB/Core/DatabaseReader.swift +++ b/GRDB/Core/DatabaseReader.swift @@ -94,7 +94,7 @@ public protocol DatabaseReader: AnyObject { /// lock acquisition is prevented. /// /// All database accesses may throw a DatabaseError of code - /// `SQLITE_INTERRUPT`, or `SQLITE_ABORT`. + /// `SQLITE_INTERRUPT`, or `SQLITE_ABORT`, except reads in WAL mode. /// /// Lock prevention ends with stopPreventingLock(). func startPreventingLock()