-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Freestanding] Only run tasks when they are awaited up on in task-to-thread model #60860
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
Conversation
@swift-ci please test |
preset=stdlib_S_standalone_minimal_macho_x86_64,build,test |
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.
Looks okey AFAICS, though the naming of this mode is very weird sounding, any better ideas? The "task to thread" doesn't really mean anything when one reads it hm. "to" what, it is not that a task is mapped "to" a thread after all, so it sounds even misleading somewhat. Is it perhaps "run tasks inline" mode, that's what it does after all 🤔
// our state | ||
_swift_task_setCurrent(oldTask); | ||
queueHead = fragment->waitQueue.load(std::memory_order_acquire); | ||
continue; |
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.
Ok makes sense 👍
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.
Looks good overall. A few little things. I agree with @ktoso that the name is confusing. Not sure what would be better though.
async-let task, we run it in the context of the parent task.
18e8919
to
a606892
Compare
@swift-ci please test |
preset=stdlib_S_standalone_minimal_macho_x86_64,build,test |
In the task-to-thread model, there are no threading mechanisms by which work could be offloaded onto another thread. When creating structured concurrency tasks however, we know that they will be awaited upon by the calling parent task which can therefore execute the child task at the point of await.
Rdar: rdar://92347604