-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
macros: make select budget-aware #7111
Conversation
ec44313
to
762526e
Compare
#[cfg_attr(docsrs, doc(cfg(feature = "rt")))] | ||
pub fn poll_budget_available(cx: &mut Context<'_>) -> Poll<()> { | ||
ready!(crate::trace::trace_leaf(cx)); | ||
if crate::runtime::coop::has_budget_remaining() { | ||
Poll::Ready(()) | ||
} else { | ||
cx.waker().wake_by_ref(); | ||
Poll::Pending | ||
} | ||
} |
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.
I think that the poll_proceed
/ made_progress
API we use internally is good. If we're going to expose more of coop, then I think we should expose that API instead of inventing a new one.
But I wouldn't do both "expose coop API" and "make select coop aware" in one PR. I'd like two PRs for the changelog.
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.
Makes sense. I'll focus on exposing our coop API in this PR and will make select budget-aware afterwards in a follow-up PR.
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.
Or rather I'll close this PR and open another one since renaming the title, rewriting the description, and resetting the labels will be messy for future reference.
Closing in order to break this effort into two upcoming PRs. |
This PR introduces a new function called
poll_budget_available
which can be called in order to poll for budget availability. This is then used inselect!
, before polling the branches, in order to make select budget-aware.Resolves #7108.