死锁
往当前
串行队列
同步
添加任务,会造成死锁
performSelector: withObject: afterDelay:
在子线程上执行这个方法,这个方法本质向runloop中添加timer,要做线程保活
performSelector: onThread: withObject: waitUntilDone:
子线程上执行方法,子线程要做线程保活
队列组
队列组的应用:任务1,任务2异步执行;任务1,任务2完成后,w执行任务
dispatch_group_t group = dispatch_group_create();
dispatch_queue_t queue = dispatch_queue_create("com.bien.abc", DISPATCH_QUEUE_CONCURRENT);
dispatch_group_async(group, queue, ^{
//task1
});
dispatch_group_async(group, queue, ^{
//task2
});
dispatch_group_notify(group, queue, ^{
// task3
});