From 17864d3dccf8986cc5a54d1d3b911558e4d7e6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Tue, 3 Dec 2019 08:15:57 +0100 Subject: [PATCH] Documentation --- GRDB/Core/Database.swift | 15 +++++++++++++-- GRDB/Core/DatabaseReader.swift | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) 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()