summaryrefslogtreecommitdiffstats
path: root/tokio/src/future
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/future
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/future')
-rw-r--r--tokio/src/future/block_on.rs15
-rw-r--r--tokio/src/future/mod.rs23
-rw-r--r--tokio/src/future/poll_fn.rs2
-rw-r--r--tokio/src/future/try_join.rs2
4 files changed, 34 insertions, 8 deletions
diff --git a/tokio/src/future/block_on.rs b/tokio/src/future/block_on.rs
new file mode 100644
index 00000000..9fc7abc6
--- /dev/null
+++ b/tokio/src/future/block_on.rs
@@ -0,0 +1,15 @@
+use std::future::Future;
+
+cfg_rt_core! {
+ pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
+ let mut e = crate::runtime::enter::enter(false);
+ e.block_on(f).unwrap()
+ }
+}
+
+cfg_not_rt_core! {
+ pub(crate) fn block_on<F: Future>(f: F) -> F::Output {
+ let mut park = crate::park::thread::CachedParkThread::new();
+ park.block_on(f).unwrap()
+ }
+}
diff --git a/tokio/src/future/mod.rs b/tokio/src/future/mod.rs
index 770753f3..f7d93c98 100644
--- a/tokio/src/future/mod.rs
+++ b/tokio/src/future/mod.rs
@@ -1,15 +1,24 @@
-#![allow(unused_imports, dead_code)]
+#![cfg_attr(not(feature = "macros"), allow(unreachable_pub))]
//! Asynchronous values.
-mod maybe_done;
-pub use maybe_done::{maybe_done, MaybeDone};
+#[cfg(any(feature = "macros", feature = "process"))]
+pub(crate) mod maybe_done;
mod poll_fn;
pub use poll_fn::poll_fn;
-mod ready;
-pub(crate) use ready::{ok, Ready};
+cfg_not_loom! {
+ mod ready;
+ pub(crate) use ready::{ok, Ready};
+}
-mod try_join;
-pub(crate) use try_join::try_join3;
+cfg_process! {
+ mod try_join;
+ pub(crate) use try_join::try_join3;
+}
+
+cfg_sync! {
+ mod block_on;
+ pub(crate) use block_on::block_on;
+}
diff --git a/tokio/src/future/poll_fn.rs b/tokio/src/future/poll_fn.rs
index 9b3d1370..0169bd5f 100644
--- a/tokio/src/future/poll_fn.rs
+++ b/tokio/src/future/poll_fn.rs
@@ -1,3 +1,5 @@
+#![allow(dead_code)]
+
//! Definition of the `PollFn` adapter combinator
use std::fmt;
diff --git a/tokio/src/future/try_join.rs b/tokio/src/future/try_join.rs
index 5bd80dc8..8943f61a 100644
--- a/tokio/src/future/try_join.rs
+++ b/tokio/src/future/try_join.rs
@@ -1,4 +1,4 @@
-use crate::future::{maybe_done, MaybeDone};
+use crate::future::maybe_done::{maybe_done, MaybeDone};
use pin_project_lite::pin_project;
use std::future::Future;