WeiLeiming
7/25/2017 - 7:43 AM

主线程运行

主线程运行

void runOnMainQueueWithoutDeadlocking(void (^block)(void)) {
    if (NSThread.isMainThread) {
        block();
    } else {
        dispatch_sync(dispatch_get_main_queue(), block);
    }
}