-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Concurrency] Run async main code on main thread #36239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Concurrency] Run async main code on main thread #36239
Conversation
@swift-ci please smoke test |
I'm going to add a check in the |
86d5eed
to
4576825
Compare
@swift-ci please smoke test |
@swift-ci please smoke test windows |
@swift-ci please smoke test windows |
This patch moves the actual running of the main code onto the main thread by making it part of the main actor. This should be more consistent with what folks are expecting.
This patch adds a check to verify that we're running on the main thread when running the async-main function.
4576825
to
12c3eb2
Compare
@swift-ci please smoke test |
@@ -77,6 +79,11 @@ actor A { | |||
@main struct RunIt { | |||
static func main() async { | |||
print("starting") | |||
if checkIfMainQueue(expectedAnswer: true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't force Windows to be running on the main thread, then this will probably fail on Windows, or at least not be all that reliable. :(
@swift-ci please smoke test macOS |
This patch moves the actual running of the main code onto the main
thread by making it part of the main actor. This should be more
consistent with what folks are expecting.
Resolves: rdar://73255194