GCD-队列组

//创建队列

 dispatch_queue_t queen = dispatch_get_global_queue(0, 0);

//创建队列组

    dispatch_group_t group = dispatch_group_create();

//创建队列组线程

    dispatch_group_async(group, queen, ^{

        NSLog(@"1-%@",[NSThread currentThread]);

    });

  dispatch_group_async(group, queen, ^{

        NSLog(@"2-%@",[NSThread currentThread]);

    });

 dispatch_group_async(group, queen, ^{

        NSLog(@"3-%@",[NSThread currentThread]);

    });

dispatch_group_async(group, queen, ^{

        NSLog(@"4-%@",[NSThread currentThread]);

    });

 dispatch_group_notify(group, queen, ^{

        NSLog(@"-------done--------");

    });

 dispatch_group_notify 这个是队列通知,如果以上四个队列任务都完成了,将会在这里进行回调

你可能感兴趣的:(GCD-队列组)