dispatch_group seems more semantically fitting than semaphore

This commit is contained in:
John Estropia
2015-09-11 13:50:29 +09:00
parent 032764b9b7
commit 726e0eabe9

View File

@@ -54,14 +54,15 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
)
self.isCommitted = true
let semaphore = GCDSemaphore(0)
let group = GCDGroup()
group.enter()
self.context.saveAsynchronouslyWithCompletion { (result) -> Void in
self.result = result
completion(result: result)
semaphore.signal()
group.leave()
}
semaphore.wait()
group.wait()
}
/**