From 69853d79011c1c01bb18d61caeced9712f096cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Fri, 26 Oct 2018 16:53:30 +0200 Subject: [PATCH] Now that user implementations of DatabaseWriter are no longer supported... ...stop pretending we have to implement concurrentRead on top of the deprecated readFromCurrentState. And this fixes #419 :-) --- GRDB/Core/DatabaseWriter.swift | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/GRDB/Core/DatabaseWriter.swift b/GRDB/Core/DatabaseWriter.swift index a72816c9e..3e0ac78bd 100644 --- a/GRDB/Core/DatabaseWriter.swift +++ b/GRDB/Core/DatabaseWriter.swift @@ -187,37 +187,6 @@ extension DatabaseWriter { #endif } - // MARK: - Reading from Database - - /// Default implementation, based on the deprecated readFromCurrentState. - /// - /// :nodoc: - public func concurrentRead(_ block: @escaping (Database) throws -> T) -> Future { - let semaphore = DispatchSemaphore(value: 0) - var result: Result? = nil - - do { - try readFromCurrentState { db in - result = Result { try block(db) } - semaphore.signal() - } - } catch { - result = .failure(error) - semaphore.signal() - } - - return Future { - _ = semaphore.wait(timeout: .distantFuture) - - switch result! { - case .failure(let error): - throw error - case .success(let result): - return result - } - } - } - // MARK: - Claiming Disk Space /// Rebuilds the database file, repacking it into a minimal amount of