Skip to content

Instantly share code, notes, and snippets.

@hollance
Created March 27, 2012 02:01
Show Gist options
  • Save hollance/2211705 to your computer and use it in GitHub Desktop.
Save hollance/2211705 to your computer and use it in GitHub Desktop.
Using GCD to perform a task in the background
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
{
// do stuff here
dispatch_async(dispatch_get_main_queue(), ^
{
// do stuff on main thread
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment