Last active
April 26, 2016 04:59
-
-
Save alanf/b1315c69af773af94d6096f17ff60beb to your computer and use it in GitHub Desktop.
Excerpt of code called from deadlocking test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)lockWithCompletionBlock:(dispatch_block_t)completionBlock { | |
@synchronized(_lockSempahore) { | |
if (!self.locked) { | |
self.locked = YES; | |
[[NSOperationQueue mainQueue] addOperationWithBlock:completionBlock]; | |
return; | |
} | |
[self.blocksWaitingOnLockAcquisition addObject:completionBlock]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment