Skip to content

Commit bb76a2c

Browse files
authored
multi_threaded feature rename (#12997)
# Objective Fixes #12966 ## Solution Renaming multi_threaded feature to match snake case ## Migration Guide Bevy feature multi-threaded should be refered to multi_threaded from now on.
1 parent 59b52fc commit bb76a2c

File tree

21 files changed

+53
-53
lines changed

21 files changed

+53
-53
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ default = [
6767
"bevy_sprite",
6868
"bevy_text",
6969
"bevy_ui",
70-
"multi-threaded",
70+
"multi_threaded",
7171
"png",
7272
"hdr",
7373
"vorbis",
@@ -252,7 +252,7 @@ symphonia-wav = ["bevy_internal/symphonia-wav"]
252252
serialize = ["bevy_internal/serialize"]
253253

254254
# Enables multithreaded parallelism in the engine. Disabling it forces all engine tasks to run on a single thread.
255-
multi-threaded = ["bevy_internal/multi-threaded"]
255+
multi_threaded = ["bevy_internal/multi_threaded"]
256256

257257
# Use async-io's implementation of block_on instead of futures-lite's implementation. This is preferred if your application uses async-io.
258258
async-io = ["bevy_internal/async-io"]

benches/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rand = "0.8"
1111
rand_chacha = "0.3"
1212
criterion = { version = "0.3", features = ["html_reports"] }
1313
bevy_app = { path = "../crates/bevy_app" }
14-
bevy_ecs = { path = "../crates/bevy_ecs", features = ["multi-threaded"] }
14+
bevy_ecs = { path = "../crates/bevy_ecs", features = ["multi_threaded"] }
1515
bevy_reflect = { path = "../crates/bevy_reflect" }
1616
bevy_tasks = { path = "../crates/bevy_tasks" }
1717
bevy_utils = { path = "../crates/bevy_utils" }

crates/bevy_asset/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ keywords = ["bevy"]
1313
[features]
1414
file_watcher = ["notify-debouncer-full", "watch"]
1515
embedded_watcher = ["file_watcher"]
16-
multi-threaded = ["bevy_tasks/multi-threaded"]
16+
multi_threaded = ["bevy_tasks/multi_threaded"]
1717
asset_processor = []
1818
watch = []
1919
trace = []

crates/bevy_asset/src/io/file/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#[cfg(feature = "file_watcher")]
22
mod file_watcher;
33

4-
#[cfg(feature = "multi-threaded")]
4+
#[cfg(feature = "multi_threaded")]
55
mod file_asset;
6-
#[cfg(not(feature = "multi-threaded"))]
6+
#[cfg(not(feature = "multi_threaded"))]
77
mod sync_file_asset;
88

99
use bevy_utils::tracing::error;

crates/bevy_asset/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ use bevy_reflect::{FromReflect, GetTypeRegistration, Reflect, TypePath};
6262
use bevy_utils::{tracing::error, HashSet};
6363
use std::{any::TypeId, sync::Arc};
6464

65-
#[cfg(all(feature = "file_watcher", not(feature = "multi-threaded")))]
65+
#[cfg(all(feature = "file_watcher", not(feature = "multi_threaded")))]
6666
compile_error!(
6767
"The \"file_watcher\" feature for hot reloading requires the \
68-
\"multi-threaded\" feature to be functional.\n\
69-
Consider either disabling the \"file_watcher\" feature or enabling \"multi-threaded\""
68+
\"multi_threaded\" feature to be functional.\n\
69+
Consider either disabling the \"file_watcher\" feature or enabling \"multi_threaded\""
7070
);
7171

7272
/// Provides "asset" loading and processing functionality. An [`Asset`] is a "runtime value" that is loaded from an [`AssetSource`],
@@ -659,8 +659,8 @@ mod tests {
659659
#[test]
660660
fn load_dependencies() {
661661
// The particular usage of GatedReader in this test will cause deadlocking if running single-threaded
662-
#[cfg(not(feature = "multi-threaded"))]
663-
panic!("This test requires the \"multi-threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi-threaded");
662+
#[cfg(not(feature = "multi_threaded"))]
663+
panic!("This test requires the \"multi_threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi_threaded");
664664

665665
let dir = Dir::default();
666666

@@ -980,8 +980,8 @@ mod tests {
980980
#[test]
981981
fn failure_load_states() {
982982
// The particular usage of GatedReader in this test will cause deadlocking if running single-threaded
983-
#[cfg(not(feature = "multi-threaded"))]
984-
panic!("This test requires the \"multi-threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi-threaded");
983+
#[cfg(not(feature = "multi_threaded"))]
984+
panic!("This test requires the \"multi_threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi_threaded");
985985

986986
let dir = Dir::default();
987987

@@ -1145,8 +1145,8 @@ mod tests {
11451145
#[test]
11461146
fn manual_asset_management() {
11471147
// The particular usage of GatedReader in this test will cause deadlocking if running single-threaded
1148-
#[cfg(not(feature = "multi-threaded"))]
1149-
panic!("This test requires the \"multi-threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi-threaded");
1148+
#[cfg(not(feature = "multi_threaded"))]
1149+
panic!("This test requires the \"multi_threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi_threaded");
11501150

11511151
let dir = Dir::default();
11521152
let dep_path = "dep.cool.ron";
@@ -1246,8 +1246,8 @@ mod tests {
12461246
#[test]
12471247
fn load_folder() {
12481248
// The particular usage of GatedReader in this test will cause deadlocking if running single-threaded
1249-
#[cfg(not(feature = "multi-threaded"))]
1250-
panic!("This test requires the \"multi-threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi-threaded");
1249+
#[cfg(not(feature = "multi_threaded"))]
1250+
panic!("This test requires the \"multi_threaded\" feature, otherwise it will deadlock.\ncargo test --package bevy_asset --features multi_threaded");
12511251

12521252
let dir = Dir::default();
12531253

crates/bevy_asset/src/processor/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ impl AssetProcessor {
152152

153153
/// Starts the processor in a background thread.
154154
pub fn start(_processor: Res<Self>) {
155-
#[cfg(any(target_arch = "wasm32", not(feature = "multi-threaded")))]
155+
#[cfg(any(target_arch = "wasm32", not(feature = "multi_threaded")))]
156156
error!("Cannot run AssetProcessor in single threaded mode (or WASM) yet.");
157-
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
157+
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
158158
{
159159
let processor = _processor.clone();
160160
std::thread::spawn(move || {
@@ -171,7 +171,7 @@ impl AssetProcessor {
171171
/// * Scan the unprocessed [`AssetReader`] and remove any final processed assets that are invalid or no longer exist.
172172
/// * For each asset in the unprocessed [`AssetReader`], kick off a new "process job", which will process the asset
173173
/// (if the latest version of the asset has not been processed).
174-
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
174+
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
175175
pub fn process_assets(&self) {
176176
let start_time = std::time::Instant::now();
177177
debug!("Processing Assets");
@@ -322,9 +322,9 @@ impl AssetProcessor {
322322
"Folder {} was added. Attempting to re-process",
323323
AssetPath::from_path(&path).with_source(source.id())
324324
);
325-
#[cfg(any(target_arch = "wasm32", not(feature = "multi-threaded")))]
325+
#[cfg(any(target_arch = "wasm32", not(feature = "multi_threaded")))]
326326
error!("AddFolder event cannot be handled in single threaded mode (or WASM) yet.");
327-
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
327+
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
328328
IoTaskPool::get().scope(|scope| {
329329
scope.spawn(async move {
330330
self.process_assets_internal(scope, source, path)
@@ -439,7 +439,7 @@ impl AssetProcessor {
439439
}
440440

441441
#[allow(unused)]
442-
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
442+
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
443443
async fn process_assets_internal<'scope>(
444444
&'scope self,
445445
scope: &'scope bevy_tasks::Scope<'scope, '_, ()>,

crates/bevy_ecs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ categories = ["game-engines", "data-structures"]
1111

1212
[features]
1313
trace = []
14-
multi-threaded = ["bevy_tasks/multi-threaded", "arrayvec"]
14+
multi_threaded = ["bevy_tasks/multi_threaded", "arrayvec"]
1515
bevy_debug_stepping = []
1616
default = ["bevy_reflect"]
1717

crates/bevy_ecs/src/event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,12 +928,12 @@ impl<'a, E: Event> EventParIter<'a, E> {
928928
///
929929
/// [`ComputeTaskPool`]: bevy_tasks::ComputeTaskPool
930930
pub fn for_each_with_id<FN: Fn(&'a E, EventId<E>) + Send + Sync + Clone>(self, func: FN) {
931-
#[cfg(any(target_arch = "wasm32", not(feature = "multi-threaded")))]
931+
#[cfg(any(target_arch = "wasm32", not(feature = "multi_threaded")))]
932932
{
933933
self.into_iter().for_each(|(e, i)| func(e, i));
934934
}
935935

936-
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
936+
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
937937
{
938938
let pool = bevy_tasks::ComputeTaskPool::get();
939939
let thread_count = pool.thread_num();

crates/bevy_ecs/src/query/par_iter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryParIter<'w, 's, D, F> {
7878
func(&mut init, item);
7979
init
8080
};
81-
#[cfg(any(target_arch = "wasm32", not(feature = "multi-threaded")))]
81+
#[cfg(any(target_arch = "wasm32", not(feature = "multi_threaded")))]
8282
{
8383
let init = init();
8484
// SAFETY:
@@ -93,7 +93,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryParIter<'w, 's, D, F> {
9393
.fold(init, func);
9494
}
9595
}
96-
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
96+
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
9797
{
9898
let thread_count = bevy_tasks::ComputeTaskPool::get().thread_num();
9999
if thread_count <= 1 {
@@ -122,7 +122,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryParIter<'w, 's, D, F> {
122122
}
123123
}
124124

125-
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
125+
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
126126
fn get_batch_size(&self, thread_count: usize) -> usize {
127127
let max_items = || {
128128
let id_iter = self.state.matched_storage_ids.iter();

crates/bevy_ecs/src/query/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,7 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
13931393
/// with a mismatched [`WorldId`] is unsound.
13941394
///
13951395
/// [`ComputeTaskPool`]: bevy_tasks::ComputeTaskPool
1396-
#[cfg(all(not(target_arch = "wasm32"), feature = "multi-threaded"))]
1396+
#[cfg(all(not(target_arch = "wasm32"), feature = "multi_threaded"))]
13971397
pub(crate) unsafe fn par_fold_init_unchecked_manual<'w, T, FN, INIT>(
13981398
&self,
13991399
init_accum: INIT,

0 commit comments

Comments
 (0)