diff options
author | Taiki Endo <te316e89@gmail.com> | 2020-10-13 06:13:23 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-12 14:13:23 -0700 |
commit | c90681bd8e629b5fde988b9f5be7b915e5cf8ae5 (patch) | |
tree | e70838b9437123dc986ebcfeb8fc0c44ca3fe667 /tokio/src/task | |
parent | 24d0a0cfa8916eaef17f40f044d978aa3904d654 (diff) |
rt: simplify rt-* features (#2949)
tokio:
merge rt-core and rt-util as rt
rename rt-threaded to rt-multi-thread
tokio-util:
rename rt-core to rt
Closes #2942
Diffstat (limited to 'tokio/src/task')
-rw-r--r-- | tokio/src/task/blocking.rs | 2 | ||||
-rw-r--r-- | tokio/src/task/local.rs | 8 | ||||
-rw-r--r-- | tokio/src/task/mod.rs | 14 | ||||
-rw-r--r-- | tokio/src/task/spawn.rs | 2 | ||||
-rw-r--r-- | tokio/src/task/yield_now.rs | 2 |
5 files changed, 12 insertions, 16 deletions
diff --git a/tokio/src/task/blocking.rs b/tokio/src/task/blocking.rs index 5f9d8af7..4c14db1b 100644 --- a/tokio/src/task/blocking.rs +++ b/tokio/src/task/blocking.rs @@ -1,6 +1,6 @@ use crate::task::JoinHandle; -cfg_rt_threaded! { +cfg_rt_multi_thread! { /// Runs the provided blocking function on the current thread without /// blocking the executor. /// diff --git a/tokio/src/task/local.rs b/tokio/src/task/local.rs index e19cbe63..5896126c 100644 --- a/tokio/src/task/local.rs +++ b/tokio/src/task/local.rs @@ -14,7 +14,7 @@ use std::task::Poll; use pin_project_lite::pin_project; -cfg_rt_util! { +cfg_rt! { /// A set of tasks which are executed on the same thread. /// /// In some cases, it is necessary to run one or more futures that do not @@ -158,7 +158,7 @@ pin_project! { scoped_thread_local!(static CURRENT: Context); -cfg_rt_util! { +cfg_rt! { /// Spawns a `!Send` future on the local task set. /// /// The spawned future will be run on the same thread that called `spawn_local.` @@ -346,8 +346,8 @@ impl LocalSet { /// [`Runtime::block_on`]: method@crate::runtime::Runtime::block_on /// [in-place blocking]: fn@crate::task::block_in_place /// [`spawn_blocking`]: fn@crate::task::spawn_blocking - #[cfg(feature = "rt-core")] - #[cfg_attr(docsrs, doc(cfg(feature = "rt-core")))] + #[cfg(feature = "rt")] + #[cfg_attr(docsrs, doc(cfg(feature = "rt")))] pub fn block_on<F>(&self, rt: &crate::runtime::Runtime, future: F) -> F::Output where F: Future, diff --git a/tokio/src/task/mod.rs b/tokio/src/task/mod.rs index 860c8929..5dc5e72c 100644 --- a/tokio/src/task/mod.rs +++ b/tokio/src/task/mod.rs @@ -102,7 +102,7 @@ //! # } //! ``` //! -//! `spawn`, `JoinHandle`, and `JoinError` are present when the "rt-core" +//! `spawn`, `JoinHandle`, and `JoinError` are present when the "rt" //! feature flag is enabled. //! //! [`task::spawn`]: crate::task::spawn() @@ -159,7 +159,7 @@ //! //! #### block_in_place //! -//! When using the [threaded runtime][rt-threaded], the [`task::block_in_place`] +//! When using the [multi-threaded runtime][rt-multi-thread], the [`task::block_in_place`] //! function is also available. Like `task::spawn_blocking`, this function //! allows running a blocking operation from an asynchronous context. Unlike //! `spawn_blocking`, however, `block_in_place` works by transitioning the @@ -211,27 +211,23 @@ //! //! [`task::spawn_blocking`]: crate::task::spawn_blocking //! [`task::block_in_place`]: crate::task::block_in_place -//! [rt-threaded]: ../runtime/index.html#threaded-scheduler +//! [rt-multi-thread]: ../runtime/index.html#threaded-scheduler //! [`task::yield_now`]: crate::task::yield_now() //! [`thread::yield_now`]: std::thread::yield_now -cfg_task! { +cfg_rt! { pub use crate::runtime::task::{JoinError, JoinHandle}; -} -cfg_rt_core! { mod blocking; pub use blocking::spawn_blocking; mod spawn; pub use spawn::spawn; - cfg_rt_threaded! { + cfg_rt_multi_thread! { pub use blocking::block_in_place; } -} -cfg_rt_util! { mod yield_now; pub use yield_now::yield_now; diff --git a/tokio/src/task/spawn.rs b/tokio/src/task/spawn.rs index d7aca572..77acb579 100644 --- a/tokio/src/task/spawn.rs +++ b/tokio/src/task/spawn.rs @@ -3,7 +3,7 @@ use crate::task::JoinHandle; use std::future::Future; -doc_rt_core! { +cfg_rt! { /// Spawns a new asynchronous task, returning a /// [`JoinHandle`](super::JoinHandle) for it. /// diff --git a/tokio/src/task/yield_now.rs b/tokio/src/task/yield_now.rs index 97e2db2c..251cb931 100644 --- a/tokio/src/task/yield_now.rs +++ b/tokio/src/task/yield_now.rs @@ -2,7 +2,7 @@ use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; -cfg_rt_util! { +cfg_rt! { /// Yields execution back to the Tokio runtime. /// /// A task yields by awaiting on `yield_now()`, and may resume when that |