Remove dispatch_queue_async_safe && optimize dispatch_main_async_safe
This commit is contained in:
parent
55d65569dc
commit
7d170d47d9
|
@ -87,15 +87,11 @@ typedef void(^SDWebImageNoParamsBlock)(void);
|
|||
|
||||
FOUNDATION_EXPORT NSString *const SDWebImageErrorDomain;
|
||||
|
||||
#ifndef dispatch_queue_async_safe
|
||||
#define dispatch_queue_async_safe(queue, block)\
|
||||
if (strcmp(dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL), dispatch_queue_get_label(queue)) == 0) {\
|
||||
#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(queue, block);\
|
||||
dispatch_async(dispatch_get_main_queue(), block);\
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef dispatch_main_async_safe
|
||||
#define dispatch_main_async_safe(block) dispatch_queue_async_safe(dispatch_get_main_queue(), block)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue