what thread does async run on

Generated on 8/2/2024

1 search

Async functions in Swift do not run on a specific thread. Instead, they are designed to make efficient use of system resources by not holding onto a thread while waiting for an asynchronous operation to complete. When an async function suspends, it yields the CPU to other tasks that have work to do, and when it resumes, it may do so on a different thread.

For more details, you can refer to the session Explore Swift performance at the timestamp 24:54.