Skip to content

Instantly share code, notes, and snippets.

@jeksys
Created December 2, 2011 14:41
Show Gist options
  • Save jeksys/1423460 to your computer and use it in GitHub Desktop.
Save jeksys/1423460 to your computer and use it in GitHub Desktop.
jumping to background
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