Skip to content

Commit 7c70fc1

Browse files
committed
remove send-ness from scheduler
1 parent 7c3131a commit 7c70fc1

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

crates/bevy_ecs/src/schedule/executor/multi_threaded.rs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ struct SystemTaskMetadata {
5858
archetype_component_access: Access<ArchetypeComponentId>,
5959
/// Indices of the systems that directly depend on the system.
6060
dependents: Vec<usize>,
61-
/// Is `true` if the system does not access `!Send` data.
62-
is_send: bool,
6361
/// Is `true` if the system is exclusive.
6462
is_exclusive: bool,
6563
}
@@ -80,8 +78,6 @@ pub struct MultiThreadedExecutor {
8078
system_task_metadata: Vec<SystemTaskMetadata>,
8179
/// Union of the accesses of all currently running systems.
8280
active_access: Access<ArchetypeComponentId>,
83-
/// Returns `true` if a system with non-`Send` access is running.
84-
local_thread_running: bool,
8581
/// Returns `true` if an exclusive system is running.
8682
exclusive_running: bool,
8783
/// The number of systems expected to run.
@@ -151,7 +147,6 @@ impl SystemExecutor for MultiThreadedExecutor {
151147
self.system_task_metadata.push(SystemTaskMetadata {
152148
archetype_component_access: default(),
153149
dependents: schedule.system_dependents[index].clone(),
154-
is_send: schedule.systems[index].is_send(),
155150
is_exclusive: schedule.systems[index].is_exclusive(),
156151
});
157152
}
@@ -270,7 +265,6 @@ impl MultiThreadedExecutor {
270265
num_completed_systems: 0,
271266
num_dependencies_remaining: Vec::new(),
272267
active_access: default(),
273-
local_thread_running: false,
274268
exclusive_running: false,
275269
evaluated_sets: FixedBitSet::new(),
276270
ready_systems: FixedBitSet::new(),
@@ -370,10 +364,6 @@ impl MultiThreadedExecutor {
370364
return false;
371365
}
372366

373-
if !system_meta.is_send && self.local_thread_running {
374-
return false;
375-
}
376-
377367
// TODO: an earlier out if world's archetypes did not change
378368
for set_idx in conditions.sets_with_conditions_of_systems[system_index]
379369
.difference(&self.evaluated_sets)
@@ -530,12 +520,7 @@ impl MultiThreadedExecutor {
530520
self.active_access
531521
.extend(&system_meta.archetype_component_access);
532522

533-
if system_meta.is_send {
534-
scope.spawn(task);
535-
} else {
536-
self.local_thread_running = true;
537-
scope.spawn_on_external(task);
538-
}
523+
scope.spawn(task);
539524
}
540525

541526
/// # Safety
@@ -583,7 +568,7 @@ impl MultiThreadedExecutor {
583568

584569
#[cfg(feature = "trace")]
585570
let task = task.instrument(task_span);
586-
scope.spawn_on_scope(task);
571+
scope.spawn(task);
587572
} else {
588573
let task = async move {
589574
#[cfg(feature = "trace")]
@@ -613,11 +598,10 @@ impl MultiThreadedExecutor {
613598

614599
#[cfg(feature = "trace")]
615600
let task = task.instrument(task_span);
616-
scope.spawn_on_scope(task);
601+
scope.spawn(task);
617602
}
618603

619604
self.exclusive_running = true;
620-
self.local_thread_running = true;
621605
}
622606

623607
fn finish_system_and_handle_dependents(&mut self, result: SystemResult) {
@@ -630,10 +614,6 @@ impl MultiThreadedExecutor {
630614
self.exclusive_running = false;
631615
}
632616

633-
if !self.system_task_metadata[system_index].is_send {
634-
self.local_thread_running = false;
635-
}
636-
637617
debug_assert!(self.num_running_systems >= 1);
638618
self.num_running_systems -= 1;
639619
self.num_completed_systems += 1;

0 commit comments

Comments
 (0)