組內異步會與組外順序執行的事件爭搶資源
1)、創建一個組
dispatch_group_t group = dispatch_group_create();
2)、組內異步ST1,DISPATCH_QUEUE_PRIORITY_DEFAULT 為默認優先級
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ //do something 1 });
3)、組內異步ST2,DISPATCH_QUEUE_PRIORITY_DEFAULT 為默認優先級
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ //do something 2 });
4)、組內通知,獲取主線程。組內異步全部執行完就到這裡
dispatch_group_notify(group, dispatch_get_main_queue(), ^{ //組內全部完成 再 do something });
5)、組外ST3
//do something 3