mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-22 04:00:39 +00:00
BusyCallback and BusyMode are Sendable
This commit is contained in:
1 parent
04d8c357b5
commit
e0d8e20bef
3 files changed
+9
-9
No files matched your search
@@ -1831,7 +1831,7 @@ extension Database {
|
||||
// MARK: - Database-Related Types
|
||||
|
||||
/// See BusyMode and <https://www.sqlite.org/c3ref/busy_handler.html>
|
||||
public typealias BusyCallback = (_ numberOfTries: Int) -> Bool
|
||||
public typealias BusyCallback = @Sendable (_ numberOfTries: Int) -> Bool
|
||||
|
||||
/// When there are several connections to a database, a connection may try
|
||||
/// to access the database while it is locked by another connection.
|
||||
@@ -1859,7 +1859,7 @@ extension Database {
|
||||
/// - <https://www.sqlite.org/c3ref/busy_handler.html>
|
||||
/// - <https://www.sqlite.org/lang_transaction.html>
|
||||
/// - <https://www.sqlite.org/wal.html>
|
||||
public enum BusyMode {
|
||||
public enum BusyMode: Sendable {
|
||||
/// The `SQLITE_BUSY` error is immediately returned to the connection
|
||||
/// that tries to access the locked database.
|
||||
case immediateError
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
- [ ] commontableexpression
|
||||
- [ ] configuration
|
||||
- [ ] customtransactionclock
|
||||
- [ ] database/busymode
|
||||
- [X] database/busymode
|
||||
- [ ] databaseaggregate
|
||||
- [ ] databasecancellable
|
||||
- [ ] databasecollation
|
||||
|
||||
@@ -244,9 +244,9 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
// BEGIN EXCLUSIVE TRANSACTION
|
||||
// COMMIT
|
||||
|
||||
var busyCallbackCalled = false
|
||||
let busyCallbackCalled = Mutex(false)
|
||||
self.busyCallback = { n in
|
||||
busyCallbackCalled = true
|
||||
busyCallbackCalled.value = true
|
||||
s2.signal()
|
||||
return true
|
||||
}
|
||||
@@ -283,7 +283,7 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
|
||||
_ = group.wait(timeout: .distantFuture)
|
||||
|
||||
XCTAssertTrue(busyCallbackCalled)
|
||||
XCTAssertTrue(busyCallbackCalled.value)
|
||||
}
|
||||
|
||||
func testReaderDuringDefaultTransaction() throws {
|
||||
@@ -384,9 +384,9 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
// COMMIT
|
||||
// COMMIT
|
||||
|
||||
var busyCallbackCalled = false
|
||||
let busyCallbackCalled = Mutex(false)
|
||||
self.busyCallback = { n in
|
||||
busyCallbackCalled = true
|
||||
busyCallbackCalled.value = true
|
||||
s3.signal()
|
||||
return true
|
||||
}
|
||||
@@ -431,6 +431,6 @@ class ConcurrencyTests: GRDBTestCase {
|
||||
|
||||
_ = group.wait(timeout: .distantFuture)
|
||||
|
||||
XCTAssertTrue(busyCallbackCalled)
|
||||
XCTAssertTrue(busyCallbackCalled.value)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user