Skip to content

Instantly share code, notes, and snippets.

@badgercl
Created October 15, 2015 14:32
Show Gist options
  • Select an option

  • Save badgercl/9c295d43c384a4ef0249 to your computer and use it in GitHub Desktop.

Select an option

Save badgercl/9c295d43c384a4ef0249 to your computer and use it in GitHub Desktop.
Dispatch on main thread (Objective-c)
#define bg_dispatch_main_async_safe(block)\
if ([NSThread isMainThread]) {\
block();\
} else {\
dispatch_async(dispatch_get_main_queue(), block);\
}
@badgercl
Copy link
Author

From SDWebImage

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