-1
字有我的代碼:dispatch_barrier_async不dispatch_get_global_queue
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
// dispatch_queue_t queue = dispatch_queue_create("zxc", DISPATCH_QUEUE_CONCURRENT);
dispatch_async(queue, ^{
NSLog(@"1");
});
dispatch_async(queue, ^{
NSLog(@"3");
});
dispatch_async(queue, ^{
NSLog(@"4");
});
dispatch_barrier_async(queue, ^{
NSLog(@"write");
});
dispatch_async(queue, ^{
NSLog(@"5");
});
dispatch_async(queue, ^{
NSLog(@"2");
});
dispatch_async(queue, ^{
NSLog(@"7");
});
dispatch_async(queue, ^{
NSLog(@"6");
});
dispatch_barrier_async
不dispatch_get_global_queue
工作,但可以用dispatch_queue_create("zxc", DISPATCH_QUEUE_CONCURRENT);
爲什麼工作?
你是什麼意思的「不起作用」?什麼是實際問題?請明確點。 – rmaddy