When execute GCD's async task, Is executing like Async/Await or not?

The closure argument to GCD routines like DispatchQueue.async(…) is a standard function, not as async one. Such functions can’t suspend in the Swift concurrency sense. So, the answer to this question:

When a GCD's specific task is executed through a specific thread, does
it run to the end once started?

is “Yes.”

However, I suspect you’ll have a bunch of follow-up questions and my advice on that front is to watch WWDC 2021 Session 10254 Swift concurrency: Behind the scenes, which is a great explanation of how the Swift concurrency runtime works.

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

3 Likes