After await, it doesn't return to the main thread

I looked into this a bit more, and I think the actual culprit is that, on non-Darwin platforms, dispatchMain() is called during the initialization of the main executor. Interestingly, the first part of the program, before hitting any real suspension point, executes inline on the main thread. That’s why the first Thread.isMainThread returns true.

P.S. Let’s fix it :D

P.P.S. Can someone move the issue from libdispatch to swift?

1 Like