Skip to content

Instantly share code, notes, and snippets.

@lukewar
Last active August 29, 2015 14:10
Show Gist options
  • Save lukewar/448f6c71852b0374437b to your computer and use it in GitHub Desktop.
Save lukewar/448f6c71852b0374437b to your computer and use it in GitHub Desktop.
Blocking asynchronous operation.
NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
dispatch_group_t dispatchGroup = dispatch_group_create();
dispatch_group_enter(dispatchGroup);
[task runWithCompletion:^{
dispatch_group_leave(dispatchGroup);
}];
dispatch_group_wait(dispatchGroup, DISPATCH_TIME_FOREVER);
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment