Swift's suspension of a task involves one of the most elegant parts of the Swift Concurrency system.
Async functions in Swift are transformed into coroutines, which are essentially state machines that allow for efficient multitasking.
When an await function like Task.sleep is encountered, the current job captures necessary state, creates a continuation, and hands it off to the Swift concurrency runtime.
The thread is immediately released when a task is suspended, showcasing Swift's efficient cooperative multitasking capabilities.