神奇的"主线程主队列,异步提交任务"

2021-12-30  本文已影响0人  大成小栈

回想一下同步、异步,多线程,任务队列之间到底有何区别。

NSLog(@"🔥🔥🔥🔥🔥");
    
// 延迟锚中
dispatch_async(dispatch_get_main_queue(), ^{
  [self handleHeaderSelected];
  NSLog(@"🐸🐸🐸");
});

//// Log
2021-12-30 21:55:41.302260+0800[24264:9584922] 🔥🔥🔥🔥🔥
2021-12-30 21:55:41.303565+0800[24264:9584922] 🔥🔥🔥🔥🔥
2021-12-30 21:55:41.304549+0800[24264:9584922] 🔥🔥🔥🔥🔥
2021-12-30 21:55:41.305520+0800[24264:9584922] 🔥🔥🔥🔥🔥
2021-12-30 21:55:41.350821+0800[24264:9584922] 🐸🐸🐸
2021-12-30 21:55:41.359901+0800[24264:9584922] 🐸🐸🐸
2021-12-30 21:55:41.362789+0800[24264:9584922] 🐸🐸🐸
2021-12-30 21:55:41.365382+0800[24264:9584922] 🐸🐸🐸
上一篇下一篇

猜你喜欢

热点阅读