Serial dispatch queues will execute their tasks one at a time. But what if I have task1 and task2 in the queue. task1 one starts execution and calls a function with a completion block (which I assume will use a different thread to execute). At this point, I believe task1 will exit, even though the completion block has not yet been called. Is it a possibility that task2 will start executing before the completion block from task 1 is executed?
Asked
Active
Viewed 28 times
1 Answers
1
Yes. In the normal case, that's exactly what will happen.
If you want to wait for something to complete before continuing, research DispatchGroup.

Rob Napier
- 286,113
- 34
- 456
- 610