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

This reverts commit e702214f82.
This commit is contained in:
DreamPiggy 2019-03-22 10:57:23 +08:00
parent 57ad6853ed
commit d36d5e7936
2 changed files with 9 additions and 9 deletions

View File

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