]> git.saurik.com Git - apple/security.git/blobdiff - keychain/ckks/CKKSCondition.m
Security-59306.41.2.tar.gz
[apple/security.git] / keychain / ckks / CKKSCondition.m
index 998c34859c7cf3f3e87c823f2b130268b145f6ec..ebef4ef2ba4155a50bc3a5e7028dcc2c6718265a 100644 (file)
 
 @interface CKKSCondition ()
 @property dispatch_semaphore_t semaphore;
+@property CKKSCondition* chain;
 @end
 
 @implementation CKKSCondition
 
--(instancetype)init
+-(instancetype)init {
+    return [self initToChain:nil];
+}
+
+-(instancetype)initToChain:(CKKSCondition*)chain
 {
     if((self = [super init])) {
         _semaphore = dispatch_semaphore_create(0);
+        _chain = chain;
     }
     return self;
 }
 
 -(void)fulfill {
     dispatch_semaphore_signal(self.semaphore);
+    [self.chain fulfill];
+    self.chain = nil; // break the retain, since that condition is filled
 }
 
 -(long)wait:(uint64_t)timeout {