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

        });

  • 相关阅读:
    Android MediaScanner 详尽分析
    你要清楚的东西
    Centos下搭建Apache+mysql+php
    Centos 安装MySQL全过程
    sdk platform tools is missing please user the sdk manager to install it
    尚书令
    文字
    ubuntu下mysql配置
    学习Android开发,配置环境,
    Sphinx全文索引安装教程
  • 原文地址:https://www.cnblogs.com/AlvinCrash/p/5614681.html
Copyright © 2011-2022 走看看