标签:队列 2.0 pre app objc rri 快速 obj time
1.GCD 延时执行:dispatch_after
/** * 延时执行 dispatch_after */ - (void)after { NSLog(@"begin"); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // 2秒后异步到主队列开始执行 NSLog(@"2秒后:%@",[NSThread currentThread]); }); NSLog(@"end"); }
2.GCD 快速迭代:dispatch_apply
3.GCD 栅栏方法:dispatch_barrier_async
4.GCD 代码只执行一次:
标签:队列 2.0 pre app objc rri 快速 obj time
原文地址:https://www.cnblogs.com/huangzhenwei/p/9728094.html