mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-30 14:21:49 +02:00
dispatch_group seems more semantically fitting than semaphore
This commit is contained in:
@@ -54,14 +54,15 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.isCommitted = true
|
self.isCommitted = true
|
||||||
let semaphore = GCDSemaphore(0)
|
let group = GCDGroup()
|
||||||
|
group.enter()
|
||||||
self.context.saveAsynchronouslyWithCompletion { (result) -> Void in
|
self.context.saveAsynchronouslyWithCompletion { (result) -> Void in
|
||||||
|
|
||||||
self.result = result
|
self.result = result
|
||||||
completion(result: result)
|
completion(result: result)
|
||||||
semaphore.signal()
|
group.leave()
|
||||||
}
|
}
|
||||||
semaphore.wait()
|
group.wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user