Documentation

This commit is contained in:
Gwendal Roué committed 2016-09-21 09:15:27 +02:00
1 parent e06abbc354
commit dda8df678a
1 file changed
+11 -11
+11 -11
View File
@@ -73,22 +73,22 @@ final class SerializedDatabase {
// }
// }
if let watchdog = SchedulingWatchdog.current {
// Case 2 is forbidden.
GRDBPrecondition(!watchdog.allows(db), "Database methods are not reentrant.")
// Case 3
return try queue.sync {
try SchedulingWatchdog.current!.allowing(databases: watchdog.allowedDatabases) {
try block(db)
}
}
} else {
guard let watchdog = SchedulingWatchdog.current else {
// Case 1
return try queue.sync {
try block(db)
}
}
// Case 2 is forbidden.
GRDBPrecondition(!watchdog.allows(db), "Database methods are not reentrant.")
// Case 3
return try queue.sync {
try SchedulingWatchdog.current!.allowing(databases: watchdog.allowedDatabases) {
try block(db)
}
}
}
/// Asynchronously executes a block in the serialized dispatch queue.