dispatch_queue_t queue = dispatch_queue_create("test", NULL);
dispatch_async(queue, ^{
NSLog(@"1");
dispatch_sync(queue, ^{
NSLog(@"2");
});
});
NSLog(@"3");
输出为3,1,当执行nslog(@"2")时产生自锁崩溃
同步线程的执行要在当前线程任务完成时再执行其他
dispatch_queue_t queue = dispatch_queue_create("test", NULL);
dispatch_async(queue, ^{
NSLog(@"1");
dispatch_sync(queue, ^{
NSLog(@"2");
});
});
NSLog(@"3");
输出为3,1,当执行nslog(@"2")时产生自锁崩溃
同步线程的执行要在当前线程任务完成时再执行其他