diff --git a/SDWebImage/Private/SDInternalMacros.h b/SDWebImage/Private/SDInternalMacros.h index 22d73dfb..3bb8442a 100644 --- a/SDWebImage/Private/SDInternalMacros.h +++ b/SDWebImage/Private/SDInternalMacros.h @@ -9,6 +9,15 @@ #import #import "metamacros.h" +#ifndef dispatch_main_async_safe +#define dispatch_main_async_safe(block)\ +if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue())) {\ + block();\ +} else {\ + dispatch_async(dispatch_get_main_queue(), block);\ +} +#endif + #ifndef SD_LOCK #define SD_LOCK(lock) dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER); #endif diff --git a/SDWebImage/SDWebImageCompat.h b/SDWebImage/SDWebImageCompat.h index f47a248a..54ec168b 100644 --- a/SDWebImage/SDWebImageCompat.h +++ b/SDWebImage/SDWebImageCompat.h @@ -84,12 +84,3 @@ #ifndef NS_OPTIONS #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type #endif - -#ifndef dispatch_main_async_safe -#define dispatch_main_async_safe(block)\ - if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue())) {\ - block();\ - } else {\ - dispatch_async(dispatch_get_main_queue(), block);\ - } -#endif