@property (strong, nonatomic) dispatch_queue_t barrierQueue;
_barrieQueue = dispatch_queue_create("Juanpi.BarrieQueue.queue", DISPATCH_QUEUE_CONCURRENT);
dispatch_async(self.barrieQueue, ^{
NSLog(@"线程1执行了 currentThread = %@",[NSThread currentThread]);
});
dispatch_async(self.barrieQueue, ^{
NSLog(@"线程2执行了 currentThread = %@",[NSThread currentThread]);
});
dispatch_async(self.barrieQueue, ^{
NSLog(@"线程3执行了 currentThread = %@",[NSThread currentThread]);
});
dispatch_async(self.barrieQueue, ^{
NSLog(@"线程4执行了 currentThread = %@",[NSThread currentThread]);
});
dispatch_async(self.barrieQueue, ^{
NSLog(@"线程5执行了 currentThread = %@",[NSThread currentThread]);
});
dispatch_async(self.barrieQueue, ^{
NSLog(@"线程6执行了 currentThread = %@",[NSThread currentThread]);
});
dispatch_barrier_async(self.barrieQueue, ^{
NSLog(@"barrierrQueue currentThread = %@",[NSThread currentThread]);
});
dispatch_async(self.barrieQueue, ^{
NSLog(@"线程7执行了 currentThread = %@",[NSThread currentThread]);
});