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

        });

  • 相关阅读:
    SQL 笔记汇总
    SQL 备份数据 脚本 -添加到作业 步骤里面 可删除历史天文件
    SQL 事物
    MS-SQL2005 执行DOS命令
    笔记 hosts文件修改 网站发布二级目录 vs2008,vs2010 css验证
    自定义日期控件
    jQuery CSS3 照片墙
    CSS3 照片墙
    jquery.cookie.js
    CSS jQuery 图片全屏切换
  • 原文地址:https://www.cnblogs.com/AlvinCrash/p/5614681.html
Copyright © 2011-2022 走看看