mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-11-30 12:13:59 +01:00
dispatch_group seems more semantically fitting than semaphore
This commit is contained in:
1 parent
032764b9b7
commit
726e0eabe9
1 file changed
+4
-3
@@ -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