Created
December 14, 2011 21:57
-
-
Save hramos/1478748 to your computer and use it in GitHub Desktop.
reality
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
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 | |
} |
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
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