From 726e0eabe93bf6e5af502f5b9ef655347382beed Mon Sep 17 00:00:00 2001 From: John Estropia Date: Fri, 11 Sep 2015 13:50:29 +0900 Subject: [PATCH] dispatch_group seems more semantically fitting than semaphore --- .../AsynchronousDataTransaction.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CoreStore/Saving and Processing/AsynchronousDataTransaction.swift b/CoreStore/Saving and Processing/AsynchronousDataTransaction.swift index 20ac7e1..f6c8591 100644 --- a/CoreStore/Saving and Processing/AsynchronousDataTransaction.swift +++ b/CoreStore/Saving and Processing/AsynchronousDataTransaction.swift @@ -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() } /**