zoukankan      html  css  js  c++  java
  • GCD 多线程同步

    @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]);

        });

  • 相关阅读:
    快速幂
    hdu 1595 find the longest of the shortest(迪杰斯特拉,减去一条边,求最大最短路)
    hdu 4121 Xiangqi
    hdu 2224 The shortest path
    hdu4923
    矩阵模板
    hdu4570(区间dp)
    hdu1978(记忆化搜索)
    hdu4283(区间dp)
    hdu1160最长递减子序列及其路径
  • 原文地址:https://www.cnblogs.com/AlvinCrash/p/5614681.html
Copyright © 2011-2022 走看看