-
-
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
coop: expose coop
as a public module
#7116
base: master
Are you sure you want to change the base?
Conversation
274caa1
to
59eca5d
Compare
//! } | ||
//! }; | ||
//! | ||
//! task::unconstrained(fut).await; |
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 are moving this, we should use the new path in examples.
//! task::unconstrained(fut).await; | |
//! task::coop::unconstrained(fut).await; |
//! | ||
//! Documentation for this can be found in the [`tokio::task`] module. | ||
//! See the "Cooperative scheduling" section in the [task](crate::task#cooperative-scheduling) module. |
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.
You deleted this section.
pub use consume_budget::consume_budget; | ||
pub mod coop; | ||
#[doc(hidden)] | ||
#[deprecated] |
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.
#[deprecated] | |
#[deprecated = "Moved to tokio::task::coop::consume_budget"] |
|
||
#[tokio::test] | ||
async fn test_has_budget_remaining() { | ||
const BUDGET: usize = 128; |
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.
Let's avoid duplicating this constant in every test. Could you move it to the top of this file?
This PR makes the
coop
module public and exposes thehas_budget_remaining
function.The motivation for this is to make
select!
budget-aware (see #7108). The exposed functionality is also useful when dealing with a combination of budget-aware and non-budget-aware futures.Related to #7111.