美文网首页
Dispatch Group

Dispatch Group

作者: ios_stand | 来源:发表于2017-07-09 19:29 被阅读0次

    在追加到Dispatch Queue中的多个处理全部结束后想执行结束处理

    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
        
        dispatch_group_t group = dispatch_group_create();
        dispatch_group_async(group, queue, ^{
            NSLog(@"0");
        });
        dispatch_group_async(group, queue, ^{
            NSLog(@"1");
        });
        dispatch_group_async(group, queue, ^{
            NSLog(@"2");
        });
        
        dispatch_group_notify(group, dispatch_get_main_queue(), ^{
            NSLog(@"done");
        });
    

    相关文章

      网友评论

          本文标题:Dispatch Group

          本文链接:https://www.haomeiwen.com/subject/lqlehxtx.html