Skip to content

Instantly share code, notes, and snippets.

@ygit
Created December 18, 2015 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ygit/3fee286e3ff988efe807 to your computer and use it in GitHub Desktop.
Save ygit/3fee286e3ff988efe807 to your computer and use it in GitHub Desktop.
Wait for an async block to complete with semaphores
dispatch_group_t group = dispatch_group_create();
dispatch_group_enter(group);
[context performBlock:^{
//block operations
dispatch_group_leave(group);
}];
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment