Skip to content

Instantly share code, notes, and snippets.

@hramos
Created December 14, 2011 21:57
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 hramos/1478748 to your computer and use it in GitHub Desktop.
Save hramos/1478748 to your computer and use it in GitHub Desktop.
reality
if (dispatch_async != NULL) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
// background stuff
dispatch_sync(dispatch_get_main_queue(), ^(void) {
// main thread stuff
});
});
} else {
// use your favorite pre-iOS 4 threading code
}
@hramos
Copy link
Author

hramos commented Dec 14, 2011

Problem: I can no longer use the same "block of code" with GCD conditionally thrown in - need to have two different implementations for same function

@hramos
Copy link
Author

hramos commented Dec 14, 2011

Another solution: use PLBlocks. But I do not wish to add any more Frameworks to this project, less so go back to GCC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment