import Foundation func nonIsolatedFunc() async { Thread.sleep(forTimeInterval: 1) } actor A { func isolatedFunc() async { let begin = Date() print("begin") for _ in 0..<32 { Task { await nonIsolatedFunc() } } Thread.sleep(forTimeInterval: 1) await Task.yield() let dur = Date().timeIntervalSince(begin) print("end \(dur)") } } @main struct Main { @MainActor static func main() async { await A().isolatedFunc() } }