Skip to content

Instantly share code, notes, and snippets.

@tmdvs
Created January 10, 2012 18:39
Show Gist options
  • Save tmdvs/1590431 to your computer and use it in GitHub Desktop.
Save tmdvs/1590431 to your computer and use it in GitHub Desktop.
NSArray *myMainThreadShit = nil;
dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
// do massive intensive shit
NSArray *myShit = [MyModel getMyShit];
dispatch_async( dispatch_get_main_queue(), ^{
// this is on main thread
myMainThreadShit = [myShit copy];
});
});
return myMainThreadShit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment