Skip to content

Instantly share code, notes, and snippets.

@r3econ
Last active August 29, 2015 13:56
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 r3econ/9345283 to your computer and use it in GitHub Desktop.
Save r3econ/9345283 to your computer and use it in GitHub Desktop.
Perform a block in a background thread, and call a completion block on the main thread when its done.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^
{
// Background thread stuff.
dispatch_async(dispatch_get_main_queue(), ^
{
// Main thread stuff.
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment