Open HeMet opened 2 months ago
@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
Output:
Thread on Swift Forums https://forums.swift.org/t/mainactor-behaves-different-on-windows-and-macos/74742