- 
                Notifications
    You must be signed in to change notification settings 
- Fork 479
Open
Description
@main
struct EntryPoint3: AsyncParsableCommand {
    @MainActor
    mutating func run() async throws {
        print("Thread is main: \(Thread.isMainThread)")
        print("Current Thread ID: \(GetCurrentThreadId())")
        MainActor.preconditionIsolated()
        await withCheckedContinuation { con in
            DispatchQueue.main.async {
                print("Thread is main (queue): \(Thread.isMainThread)")
                print("Current Thread ID (queue): \(GetCurrentThreadId())")
                MainActor.preconditionIsolated()
                con.resume()
            }
        }
        print("completed")
    }
}Output:
Thread is main: false
Current Thread ID: 498188
Thread is main (queue): false
Current Thread ID (queue): 498188
completed
Thread on Swift Forums https://forums.swift.org/t/mainactor-behaves-different-on-windows-and-macos/74742
flopshotdaniel-j-dev and ktraunmueller
Metadata
Metadata
Assignees
Labels
No labels