diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 756a7677b9f..d3743592191 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,7 +110,7 @@ jobs: rm -rf tokio/tests - name: miri - run: cargo miri test --features rt-core,rt-threaded,rt-util,sync task + run: cargo miri test --features rt-core,rt-multi-thread,rt-util,sync task working-directory: tokio cross: diff --git a/tests-build/tests/fail/macros_core_no_default.stderr b/tests-build/tests/fail/macros_core_no_default.stderr index a3ae32cd752..6b3f8fa6c28 100644 --- a/tests-build/tests/fail/macros_core_no_default.stderr +++ b/tests-build/tests/fail/macros_core_no_default.stderr @@ -1,4 +1,4 @@ -error: The default runtime flavor is `multi_thread`, but the `rt-threaded` feature is disabled. +error: The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled. --> $DIR/macros_core_no_default.rs:3:1 | 3 | #[tokio::main] diff --git a/tests-integration/Cargo.toml b/tests-integration/Cargo.toml index c6dd8450148..9fd4e1d451c 100644 --- a/tests-integration/Cargo.toml +++ b/tests-integration/Cargo.toml @@ -9,7 +9,7 @@ publish = false full = [ "macros", "rt-core", - "rt-threaded", + "rt-multi-thread", "tokio/full", "tokio-test" @@ -17,7 +17,7 @@ full = [ macros = ["tokio/macros"] sync = ["tokio/sync"] rt-core = ["tokio/rt-core"] -rt-threaded = ["rt-core", "tokio/rt-threaded"] +rt-multi-thread = ["rt-core", "tokio/rt-multi-thread"] [dependencies] tokio = { path = "../tokio" } diff --git a/tokio-macros/src/entry.rs b/tokio-macros/src/entry.rs index f3c7c2300c6..04a2357b900 100644 --- a/tokio-macros/src/entry.rs +++ b/tokio-macros/src/entry.rs @@ -97,9 +97,9 @@ impl Configuration { }), (Threaded, _) => { let msg = if self.flavor.is_none() { - "The default runtime flavor is `multi_thread`, but the `rt-threaded` feature is disabled." + "The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled." } else { - "The runtime flavor `multi_thread` requires the `rt-threaded` feature." + "The runtime flavor `multi_thread` requires the `rt-multi-thread` feature." }; Err(syn::Error::new(Span::call_site(), msg)) } diff --git a/tokio-macros/src/lib.rs b/tokio-macros/src/lib.rs index 1d6f577a8f1..e80605a61b5 100644 --- a/tokio-macros/src/lib.rs +++ b/tokio-macros/src/lib.rs @@ -258,13 +258,13 @@ pub fn test_rt_core(args: TokenStream, item: TokenStream) -> TokenStream { /// Always fails with the error message below. /// ```text -/// The #[tokio::main] macro requires rt-core or rt-threaded. +/// The #[tokio::main] macro requires rt-core or rt-multi-thread. /// ``` #[proc_macro_attribute] pub fn main_fail(_args: TokenStream, _item: TokenStream) -> TokenStream { syn::Error::new( proc_macro2::Span::call_site(), - "The #[tokio::main] macro requires rt-core or rt-threaded.", + "The #[tokio::main] macro requires rt-core or rt-multi-thread.", ) .to_compile_error() .into() @@ -272,13 +272,13 @@ pub fn main_fail(_args: TokenStream, _item: TokenStream) -> TokenStream { /// Always fails with the error message below. /// ```text -/// The #[tokio::test] macro requires rt-core or rt-threaded. +/// The #[tokio::test] macro requires rt-core or rt-multi-thread. /// ``` #[proc_macro_attribute] pub fn test_fail(_args: TokenStream, _item: TokenStream) -> TokenStream { syn::Error::new( proc_macro2::Span::call_site(), - "The #[tokio::test] macro requires rt-core or rt-threaded.", + "The #[tokio::test] macro requires rt-core or rt-multi-thread.", ) .to_compile_error() .into() diff --git a/tokio/Cargo.toml b/tokio/Cargo.toml index cb407f9311d..e2ea370700b 100644 --- a/tokio/Cargo.toml +++ b/tokio/Cargo.toml @@ -39,7 +39,7 @@ full = [ "process", "rt-core", "rt-util", - "rt-threaded", + "rt-multi-thread", "signal", "stream", "sync", @@ -65,7 +65,7 @@ process = [ # Includes basic task execution capabilities rt-core = ["slab"] rt-util = [] -rt-threaded = [ +rt-multi-thread = [ "num_cpus", "rt-core", ] diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs index 1334eb88c7e..81cbe77eb46 100644 --- a/tokio/src/lib.rs +++ b/tokio/src/lib.rs @@ -74,7 +74,7 @@ //! //! - `full`: Enables all Tokio public API features listed below. //! - `rt-core`: Enables `tokio::spawn` and the basic (single-threaded) scheduler. -//! - `rt-threaded`: Enables the heavier, multi-threaded, work-stealing scheduler. +//! - `rt-multi-thread`: Enables the heavier, multi-threaded, work-stealing scheduler. //! - `rt-util`: Enables non-scheduler utilities. //! - `io-util`: Enables the IO based `Ext` traits. //! - `io-std`: Enable `Stdout`, `Stdin` and `Stderr` types. @@ -199,9 +199,9 @@ //! and managing runtimes. You should use that module if the `#[tokio::main]` macro doesn't //! provide the functionality you need. //! -//! Using the runtime requires the "rt-core" or "rt-threaded" feature flags, to +//! Using the runtime requires the "rt-core" or "rt-multi-thread" feature flags, to //! enable the basic [single-threaded scheduler][rt-core] and the [thread-pool -//! scheduler][rt-threaded], respectively. See the [`runtime` module +//! scheduler][rt-multi-thread], respectively. See the [`runtime` module //! documentation][rt-features] for details. In addition, the "macros" feature //! flag enables the `#[tokio::main]` and `#[tokio::test]` attributes. //! @@ -210,7 +210,7 @@ //! [`Builder`]: crate::runtime::Builder //! [`Runtime`]: crate::runtime::Runtime //! [rt-core]: runtime/index.html#basic-scheduler -//! [rt-threaded]: runtime/index.html#threaded-scheduler +//! [rt-multi-thread]: runtime/index.html#threaded-scheduler //! [rt-features]: runtime/index.html#runtime-scheduler //! //! ## CPU-bound tasks and blocking code diff --git a/tokio/src/loom/std/mod.rs b/tokio/src/loom/std/mod.rs index 6492848ef4e..0c4a09a1666 100644 --- a/tokio/src/loom/std/mod.rs +++ b/tokio/src/loom/std/mod.rs @@ -81,12 +81,12 @@ pub(crate) mod sync { } pub(crate) mod sys { - #[cfg(feature = "rt-threaded")] + #[cfg(feature = "rt-multi-thread")] pub(crate) fn num_cpus() -> usize { usize::max(1, num_cpus::get()) } - #[cfg(not(feature = "rt-threaded"))] + #[cfg(not(feature = "rt-multi-thread"))] pub(crate) fn num_cpus() -> usize { 1 } diff --git a/tokio/src/macros/cfg.rs b/tokio/src/macros/cfg.rs index 83102da698d..fcef5c9b328 100644 --- a/tokio/src/macros/cfg.rs +++ b/tokio/src/macros/cfg.rs @@ -277,8 +277,8 @@ macro_rules! cfg_not_rt_core { macro_rules! cfg_rt_threaded { ($($item:item)*) => { $( - #[cfg(feature = "rt-threaded")] - #[cfg_attr(docsrs, doc(cfg(feature = "rt-threaded")))] + #[cfg(feature = "rt-multi-thread")] + #[cfg_attr(docsrs, doc(cfg(feature = "rt-multi-thread")))] $item )* } @@ -296,7 +296,7 @@ macro_rules! cfg_rt_util { macro_rules! cfg_not_rt_threaded { ($($item:item)*) => { - $( #[cfg(not(feature = "rt-threaded"))] $item )* + $( #[cfg(not(feature = "rt-multi-thread"))] $item )* } } diff --git a/tokio/src/runtime/builder.rs b/tokio/src/runtime/builder.rs index 8e76f52b966..0c1a4c47b1d 100644 --- a/tokio/src/runtime/builder.rs +++ b/tokio/src/runtime/builder.rs @@ -73,7 +73,7 @@ pub(crate) type ThreadNameFn = std::sync::Arc String + Send + Sync + pub(crate) enum Kind { CurrentThread, - #[cfg(feature = "rt-threaded")] + #[cfg(feature = "rt-multi-thread")] MultiThread, } @@ -84,7 +84,7 @@ impl Builder { } /// TODO - #[cfg(feature = "rt-threaded")] + #[cfg(feature = "rt-multi-thread")] pub fn new_multi_thread() -> Builder { Builder::new(Kind::MultiThread) } @@ -366,7 +366,7 @@ impl Builder { pub fn build(&mut self) -> io::Result { match &self.kind { Kind::CurrentThread => self.build_basic_runtime(), - #[cfg(feature = "rt-threaded")] + #[cfg(feature = "rt-multi-thread")] Kind::MultiThread => self.build_threaded_runtime(), } } diff --git a/tokio/src/runtime/mod.rs b/tokio/src/runtime/mod.rs index c79a942f647..5e093f44038 100644 --- a/tokio/src/runtime/mod.rs +++ b/tokio/src/runtime/mod.rs @@ -129,7 +129,7 @@ //! The multi-thread scheduler executes futures on a _thread pool_, using a //! work-stealing strategy. By default, it will start a worker thread for each //! CPU core available on the system. This tends to be the ideal configurations -//! for most applications. The multi-thread scheduler requires the `rt-threaded` +//! for most applications. The multi-thread scheduler requires the `rt-multi-thread` //! feature flag, and is selected by default: //! ``` //! use tokio::runtime; @@ -270,7 +270,7 @@ cfg_rt_core! { CurrentThread(BasicScheduler), /// Execute tasks across multiple threads. - #[cfg(feature = "rt-threaded")] + #[cfg(feature = "rt-multi-thread")] ThreadPool(ThreadPool), } @@ -282,7 +282,7 @@ cfg_rt_core! { /// /// This results in a scheduler, I/O driver, and time driver being /// initialized. The type of scheduler used depends on what feature flags - /// are enabled: if the `rt-threaded` feature is enabled, the [threaded + /// are enabled: if the `rt-multi-thread` feature is enabled, the [threaded /// scheduler] is used, while if only the `rt-core` feature is enabled, the /// [basic scheduler] is used instead. /// @@ -313,7 +313,7 @@ cfg_rt_core! { /// [threaded scheduler]: index.html#threaded-scheduler /// [basic scheduler]: index.html#basic-scheduler /// [runtime builder]: crate::runtime::Builder - #[cfg(feature = "rt-threaded")] + #[cfg(feature = "rt-multi-thread")] pub fn new() -> std::io::Result { Builder::new_multi_thread().enable_all().build() } @@ -350,7 +350,7 @@ cfg_rt_core! { F::Output: Send + 'static, { match &self.kind { - #[cfg(feature = "rt-threaded")] + #[cfg(feature = "rt-multi-thread")] Kind::ThreadPool(exec) => exec.spawn(future), Kind::CurrentThread(exec) => exec.spawn(future), } @@ -395,7 +395,7 @@ cfg_rt_core! { self.handle.enter(|| match &self.kind { #[cfg(feature = "rt-core")] Kind::CurrentThread(exec) => exec.block_on(future), - #[cfg(feature = "rt-threaded")] + #[cfg(feature = "rt-multi-thread")] Kind::ThreadPool(exec) => exec.block_on(future), }) } diff --git a/tokio/src/runtime/spawner.rs b/tokio/src/runtime/spawner.rs index 28ff7c04460..4af3e6ebf72 100644 --- a/tokio/src/runtime/spawner.rs +++ b/tokio/src/runtime/spawner.rs @@ -13,13 +13,13 @@ cfg_rt_threaded! { pub(crate) enum Spawner { #[cfg(feature = "rt-core")] Basic(basic_scheduler::Spawner), - #[cfg(feature = "rt-threaded")] + #[cfg(feature = "rt-multi-thread")] ThreadPool(thread_pool::Spawner), } impl Spawner { pub(crate) fn shutdown(&mut self) { - #[cfg(feature = "rt-threaded")] + #[cfg(feature = "rt-multi-thread")] { if let Spawner::ThreadPool(spawner) = self { spawner.shutdown(); @@ -38,7 +38,7 @@ cfg_rt_core! { match self { #[cfg(feature = "rt-core")] Spawner::Basic(spawner) => spawner.spawn(future), - #[cfg(feature = "rt-threaded")] + #[cfg(feature = "rt-multi-thread")] Spawner::ThreadPool(spawner) => spawner.spawn(future), } } diff --git a/tokio/src/task/mod.rs b/tokio/src/task/mod.rs index 860c8929e28..075ff9b0646 100644 --- a/tokio/src/task/mod.rs +++ b/tokio/src/task/mod.rs @@ -159,7 +159,7 @@ //! //! #### block_in_place //! -//! When using the [threaded runtime][rt-threaded], the [`task::block_in_place`] +//! When using the [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,7 +211,7 @@ //! //! [`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 diff --git a/tokio/src/util/mod.rs b/tokio/src/util/mod.rs index e1bcb4b89eb..5b0c8014756 100644 --- a/tokio/src/util/mod.rs +++ b/tokio/src/util/mod.rs @@ -16,7 +16,7 @@ cfg_io_driver! { ))] pub(crate) mod linked_list; -#[cfg(any(feature = "rt-threaded", feature = "macros", feature = "stream"))] +#[cfg(any(feature = "rt-multi-thread", feature = "macros", feature = "stream"))] mod rand; cfg_rt_core! {