Skip to content

Instantly share code, notes, and snippets.

@danmartyn
Created October 15, 2013 04:18
Show Gist options
  • Save danmartyn/6986419 to your computer and use it in GitHub Desktop.
Save danmartyn/6986419 to your computer and use it in GitHub Desktop.
Typical use case for GCD
// Doing something on the main thread
dispatch_queue_t myQueue = dispatch_queue_create("My Queue",NULL);
dispatch_async(myQueue, ^{
// Perform long running process
dispatch_async(dispatch_get_main_queue(), ^{
// Update the UI
});
});
// Continue doing other stuff on the
// main thread while process is running.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment