Skip to content

Instantly share code, notes, and snippets.

@alanf
Last active April 26, 2016 04:59
Show Gist options
  • Save alanf/b1315c69af773af94d6096f17ff60beb to your computer and use it in GitHub Desktop.
Save alanf/b1315c69af773af94d6096f17ff60beb to your computer and use it in GitHub Desktop.
Excerpt of code called from deadlocking test
- (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