Avatar
@swift-5.5.3 -Xfrontend -parse-as-library import Foundation @globalActor actor OtherActor { static let shared = OtherActor() static func run(_ body: @OtherActor () async -> Void) async { @OtherActor func inner() async { await body() } await inner() } } @main struct Entrypoint { static func main() async throws { print(Thread.current, Thread.isMainThread) await OtherActor.run { let _: () = await withUnsafeContinuation { c in test2 { // com.apple.root.default-qos.cooperative print(Thread.current, Thread.isMainThread) c.resume(returning: ()) } } let _: () = await withUnsafeContinuation { c in test2 { @MainActor () in // com.apple.main-thread print(Thread.current, Thread.isMainThread) c.resume(returning: ()) } } } } } private func test1(_ f: @MainActor @escaping () async -> Void) { Task.detached { await f() } } private func test2(_ f: @escaping () async -> Void) { test1(f) } (edited)