Created
December 2, 2011 14:41
-
-
Save jeksys/1423460 to your computer and use it in GitHub Desktop.
jumping to background
This file contains 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 callerQueue = dispatch_get_current_queue(); | |
dispatch_retain(callerQueue); | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
// Do the work in the other thread... | |
// Example: NSArray* items = parseJSON(data); | |
dispatch_async(callerQueue, ^{ | |
// Report results to the caller... | |
// Example: [self didParseItems:items]; | |
dispatch_release(callerQueue); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment