Move the dispatch_main_async_safe into internal macros, since it's used in implementation files but not headers

SDWebImageCompat.h should only contain the macros support used in header
This commit is contained in:
DreamPiggy 2019-03-19 13:21:29 +08:00
parent c6247d2d63
commit e702214f82
2 changed files with 9 additions and 9 deletions

View File

@ -9,6 +9,15 @@
#import <Foundation/Foundation.h>
#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

View File

@ -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