summaryrefslogtreecommitdiffstats
path: root/tokio/src/coop.rs
diff options
context:
space:
mode:
authorLucio Franco <luciofranco14@gmail.com>2020-10-12 13:44:54 -0400
committerGitHub <noreply@github.com>2020-10-12 13:44:54 -0400
commit8880222036f37c6204c8466f25e828447f16dacb (patch)
treefd623afc20f73bbce65746a3d1b1b2731ecf30a5 /tokio/src/coop.rs
parent0893841f31542b2b04c5050a8a4a3c45cf867e55 (diff)
rt: Remove `threaded_scheduler()` and `basic_scheduler()` (#2876)
Co-authored-by: Alice Ryhl <alice@ryhl.io> Co-authored-by: Carl Lerche <me@carllerche.com>
Diffstat (limited to 'tokio/src/coop.rs')
-rw-r--r--tokio/src/coop.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/tokio/src/coop.rs b/tokio/src/coop.rs
index 27e969c5..f6cca1c5 100644
--- a/tokio/src/coop.rs
+++ b/tokio/src/coop.rs
@@ -1,3 +1,5 @@
+#![cfg_attr(not(feature = "full"), allow(dead_code))]
+
//! Opt-in yield points for improved cooperative scheduling.
//!
//! A single call to [`poll`] on a top-level task may potentially do a lot of
@@ -96,14 +98,6 @@ pub(crate) fn budget<R>(f: impl FnOnce() -> R) -> R {
with_budget(Budget::initial(), f)
}
-cfg_rt_threaded! {
- /// Set the current task's budget
- #[cfg(feature = "blocking")]
- pub(crate) fn set(budget: Budget) {
- CURRENT.with(|cell| cell.set(budget))
- }
-}
-
#[inline(always)]
fn with_budget<R>(budget: Budget, f: impl FnOnce() -> R) -> R {
struct ResetGuard<'a> {
@@ -129,13 +123,18 @@ fn with_budget<R>(budget: Budget, f: impl FnOnce() -> R) -> R {
}
cfg_rt_threaded! {
+ /// Set the current task's budget
+ pub(crate) fn set(budget: Budget) {
+ CURRENT.with(|cell| cell.set(budget))
+ }
+
#[inline(always)]
pub(crate) fn has_budget_remaining() -> bool {
CURRENT.with(|cell| cell.get().has_remaining())
}
}
-cfg_blocking_impl! {
+cfg_rt_core! {
/// Forcibly remove the budgeting constraints early.
///
/// Returns the remaining budget