diff --git a/SDWebImage/SDWebImageCompat.h b/SDWebImage/SDWebImageCompat.h index 3c21b413..c0e0a807 100644 --- a/SDWebImage/SDWebImageCompat.h +++ b/SDWebImage/SDWebImageCompat.h @@ -57,16 +57,20 @@ typedef void(^SDWebImageNoParamsBlock)(); extern NSString *const SDWebImageErrorDomain; +#ifndef dispatch_main_sync_safe #define dispatch_main_sync_safe(block)\ if ([NSThread isMainThread]) {\ block();\ } else {\ dispatch_sync(dispatch_get_main_queue(), block);\ } +#endif +#ifndef dispatch_main_async_safe #define dispatch_main_async_safe(block)\ if ([NSThread isMainThread]) {\ block();\ } else {\ dispatch_async(dispatch_get_main_queue(), block);\ } +#endif