Reputation: 71
It is said that :
GCD lets us create groups, which allow you to place your tasks in one place, run all of them, and get a notification at the end from GCD. Those group blocks of code together ensure that all of them get executed by GCD one by one, as dependencies of one another.
As those blocks are getting executed one by one, then technically GCD function for dispatch_group should be dispatch_group_sync not dispatch_group_async.
Thanks in advance for great explanation.
Upvotes: 3
Views: 765
Reputation: 24714
Because here async is relative to the thread(Common main tread) that the block is submitted.
You do not need to sync groups to that thread,you just add code to that thread,code is executed one by one.
Besides,with dispatch group.
DISPATCH_QUEUE_SERIAL
).DISPATCH_QUEUE_CONCURRENT
).Upvotes: 4