Skip to content

Instantly share code, notes, and snippets.

@danpalmer
Last active December 19, 2015 17:49
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 danpalmer/5994709 to your computer and use it in GitHub Desktop.
Save danpalmer/5994709 to your computer and use it in GitHub Desktop.
dispatch_queue_t queue =
dispatch_queue_create("com.example.background", DISPATCH_QUEUE_CONCURRENT);
for (int i = 0; i < 50; i++) {
dispatch_async(queue, ^{
sleep(3);
NSLog(@"Block %d finished", i);
});
}
NSLog(@"Finished Dispatch");
dispatch_barrier_async(queue, ^{
NSLog(@"Completed");
});
NSLog(@"Continuing Execution");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment