From d9702d35f18b60e73828b6edf0ddc05b88267229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E5=90=89=E5=B3=B0?= Date: Thu, 3 Aug 2023 15:47:09 +0800 Subject: [PATCH] opt-out `multi-threaded` feature flag (#9269) # Objective Fixes #9113 ## Solution disable `multi-threaded` default feature ## Migration Guide The `multi-threaded` feature in `bevy_ecs` and `bevy_tasks` is no longer enabled by default. However, this remains a default feature for the umbrella `bevy` crate. If you depend on `bevy_ecs` or `bevy_tasks` directly, you should consider enabling this to allow systems to run in parallel. --- crates/bevy_ecs/Cargo.toml | 2 +- crates/bevy_tasks/Cargo.toml | 1 - crates/bevy_tasks/src/lib.rs | 4 ++-- crates/bevy_tasks/src/single_threaded_task_pool.rs | 1 - 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/bevy_ecs/Cargo.toml b/crates/bevy_ecs/Cargo.toml index dc13ba8ee0..980174d833 100644 --- a/crates/bevy_ecs/Cargo.toml +++ b/crates/bevy_ecs/Cargo.toml @@ -12,7 +12,7 @@ categories = ["game-engines", "data-structures"] [features] trace = [] multi-threaded = ["bevy_tasks/multi-threaded"] -default = ["bevy_reflect", "multi-threaded"] +default = ["bevy_reflect"] [dependencies] bevy_ptr = { path = "../bevy_ptr", version = "0.12.0-dev" } diff --git a/crates/bevy_tasks/Cargo.toml b/crates/bevy_tasks/Cargo.toml index bcedb8b944..d7d2f8fb6c 100644 --- a/crates/bevy_tasks/Cargo.toml +++ b/crates/bevy_tasks/Cargo.toml @@ -10,7 +10,6 @@ keywords = ["bevy"] [features] multi-threaded = [] -default = ["multi-threaded"] [dependencies] futures-lite = "1.4.0" diff --git a/crates/bevy_tasks/src/lib.rs b/crates/bevy_tasks/src/lib.rs index ffdce2d63c..b97d2e9df4 100644 --- a/crates/bevy_tasks/src/lib.rs +++ b/crates/bevy_tasks/src/lib.rs @@ -23,9 +23,9 @@ mod usages; pub use usages::tick_global_task_pools_on_main_thread; pub use usages::{AsyncComputeTaskPool, ComputeTaskPool, IoTaskPool}; -#[cfg(not(target_arch = "wasm32"))] +#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))] mod thread_executor; -#[cfg(not(target_arch = "wasm32"))] +#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))] pub use thread_executor::{ThreadExecutor, ThreadExecutorTicker}; mod iter; diff --git a/crates/bevy_tasks/src/single_threaded_task_pool.rs b/crates/bevy_tasks/src/single_threaded_task_pool.rs index 92e2928124..2e47468b8e 100644 --- a/crates/bevy_tasks/src/single_threaded_task_pool.rs +++ b/crates/bevy_tasks/src/single_threaded_task_pool.rs @@ -1,4 +1,3 @@ -#[cfg(target_arch = "wasm32")] use std::sync::Arc; use std::{cell::RefCell, future::Future, marker::PhantomData, mem, rc::Rc};