GCD 死锁
2017-04-26 本文已影响0人
James_Feng
1、 main_queue中追加block
dispatch_apply(10, dispatch_get_main_queue(), ^(size_t index) {
NSLog(@"index:%zu %@",index,[NSThread currentThread]);
});
2、main_queue中添加同步任务
dispatch_sync(dispatch_get_main_queue(), ^{
})
3、main_queue添加同步barrier
dispatch_barrier_sync(dispatch_get_main_queue(), ^{
NSLog(@"2 %s",__func__);
});