Created
June 21, 2012 11:28
-
-
Save level09/2965229 to your computer and use it in GitHub Desktop.
iOS Run a task in background with a callback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch_queue_t queue = dispatch_queue_create("yourname", NULL); | |
// execute a task on that queue asynchronously | |
dispatch_async(queue, ^{ | |
//Code to execute here | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
// Callback on the main thread when code above is done | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment