GCD 학습(5) dispatchbarrier_async

2227 단어 Dispatch
먼저 세그먼트 코드를 보십시오
    dispatch_queue_t concurrentQueue = dispatch_queue_create("my.concurrent.queue", DISPATCH_QUEUE_CONCURRENT);
    dispatch_async(concurrentQueue, ^(){
        NSLog(@"dispatch-1");
    });
    dispatch_async(concurrentQueue, ^(){
        NSLog(@"dispatch-2");
    });
    dispatch_barrier_async(concurrentQueue, ^(){
        NSLog(@"dispatch-barrier"); 
    });
    dispatch_async(concurrentQueue, ^(){
        NSLog(@"dispatch-3");
    });
    dispatch_async(concurrentQueue, ^(){
        NSLog(@"dispatch-4");
    });
dispatch_barrier_async          ,              ,       
dispatch-1,dispatch-2
    
dispatch_barrier_async    ,(            )     ,   
"dispatch-barrier,
dispatch-3,dispatch-4

좋은 웹페이지 즐겨찾기