Tencent / LKImageKit

A high-performance image framework, including a series of capabilities such as image views, image downloader, memory caches, disk caches, image decoders and image processors.
Other
2.08k stars 287 forks source link

LKDispatch 函数内是否应该将 dispatch_sync(queue, block) 改为 dispatch_async(queue, block) ? #39

Open PipeDog opened 3 years ago

PipeDog commented 3 years ago

inline static void LKDispatch(BOOL sync, dispatch_queue_t _Nonnull queue, dispatch_block_t _Nonnull block) { if (sync) { block(); } else { if (dispatch_queue_get_label(queue) == dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL)) { block(); } else { dispatch_sync(queue, block); } } }