Skip to content

Conversation

etcwilde
Copy link
Member

@etcwilde etcwilde commented Sep 7, 2021

I'm proposing that we don't place the whole main function on the task
queue, but instead run everything from the start of the program to the
first suspension point synchronously so that programmers may ensure that
initialization code is run before the runloop is running.

Additionally, I'd like to propose that the main function is implicitly
annotated with the @mainactor annotation and that it inherit the
priority of the main thread.

I have this proposal partially implemented here: swiftlang/swift#38604

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking ready for a review. Please add the few requested fields (see review comments) and we'll get this merged, numbered, and scheduled for a review.

* Authors: [Evan Wilde](https://github.com/etcwilde)
* Review Manager: TBD
* Status: **Awaiting Implementation**

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add links to the pitches and implementation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

I'm proposing that we don't place the whole main function on the task
queue, but instead run everything from the start of the program to the
first suspension point synchronously so that programmers may ensure that
initialization code is run before the runloop is running.

Additionally, I'd like to propose that the main function is implicitly
annotated with the @mainactor annotation and that it inherit the
priority of the main thread.
Applying editorial changes recommended by Ben.
Thanks!

Co-authored-by: Ben Rimmington <me@benrimmington.com>
@DougGregor DougGregor merged commit 94330de into swiftlang:main Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants