Skip to content
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

task: stop polling more tasks when yield_now is used on a LocalSet #5211

Closed
wants to merge 1 commit into from

Conversation

Darksonn
Copy link
Contributor

Closes: #5209

This also fixes a bug where an unhandled panic wouldn't be detected until next poll of the LocalSet if it happened in the 61st task of a tick.

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-task Module: tokio/task labels Nov 20, 2022
@carllerche
Copy link
Member

Thanks for taking a stab at this.

If I understand the PR, if a task is notified during the poll, it will force the entire LocalSet to yield back to the runtime. If so, I'm a little hesitant to merge this strategy as I think it is a bit too aggressive. The LocalSet will yield itself, but I think it should continue to poll pending tasks, just not poll the yielded task.

We discussed a different strategy for handling yields in discord that should also resolve the original issue.

@carllerche
Copy link
Member

Thanks for the work here. This PR is superseded by #5223.

@carllerche carllerche closed this Nov 30, 2022
@carllerche carllerche deleted the alice/localset-yield-now branch December 1, 2022 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-task Module: tokio/task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

yield_now not yielding since MAX_TASKS_PER_TICK in LocalSet is hardcoded
2 participants