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

        });

  • 相关阅读:
    #什么是spring#
    spark sql 判断一列是否包含某字符
    win10 安装微软商店
    python获取一段时间的日期
    css 网格
    css 网格属性总结
    css flex容器属性总结
    CSS Flexbox
    响应式Web设计
    css 伪类选择器
  • 原文地址:https://www.cnblogs.com/AlvinCrash/p/5614681.html
Copyright © 2020-2023  润新知