Skip to content

Instantly share code, notes, and snippets.

@followben
Created May 30, 2012 18:54
Show Gist options
  • Save followben/2838276 to your computer and use it in GitHub Desktop.
Save followben/2838276 to your computer and use it in GitHub Desktop.
qt_dispatch_sync_to_main_queue - performSelector on main thread for GCD
void qt_dispatch_sync_to_main_queue(dispatch_block_t aBlock) {
if ([NSThread isMainThread]) {
aBlock();
} else {
dispatch_sync(dispatch_get_main_queue(), aBlock);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment