From 7c70fc169140fd0430bad6c62ba03ee221b2c5a2 Mon Sep 17 00:00:00 2001 From: Cameron <51241057+maniwani@users.noreply.github.com> Date: Fri, 3 Feb 2023 12:16:45 -0800 Subject: [PATCH] remove send-ness from scheduler --- .../src/schedule/executor/multi_threaded.rs | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs b/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs index 8f6a3133c5966e..cb206143eb5c5e 100644 --- a/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs +++ b/crates/bevy_ecs/src/schedule/executor/multi_threaded.rs @@ -58,8 +58,6 @@ struct SystemTaskMetadata { archetype_component_access: Access, /// Indices of the systems that directly depend on the system. dependents: Vec, - /// Is `true` if the system does not access `!Send` data. - is_send: bool, /// Is `true` if the system is exclusive. is_exclusive: bool, } @@ -80,8 +78,6 @@ pub struct MultiThreadedExecutor { system_task_metadata: Vec, /// Union of the accesses of all currently running systems. active_access: Access, - /// Returns `true` if a system with non-`Send` access is running. - local_thread_running: bool, /// Returns `true` if an exclusive system is running. exclusive_running: bool, /// The number of systems expected to run. @@ -151,7 +147,6 @@ impl SystemExecutor for MultiThreadedExecutor { self.system_task_metadata.push(SystemTaskMetadata { archetype_component_access: default(), dependents: schedule.system_dependents[index].clone(), - is_send: schedule.systems[index].is_send(), is_exclusive: schedule.systems[index].is_exclusive(), }); } @@ -270,7 +265,6 @@ impl MultiThreadedExecutor { num_completed_systems: 0, num_dependencies_remaining: Vec::new(), active_access: default(), - local_thread_running: false, exclusive_running: false, evaluated_sets: FixedBitSet::new(), ready_systems: FixedBitSet::new(), @@ -370,10 +364,6 @@ impl MultiThreadedExecutor { return false; } - if !system_meta.is_send && self.local_thread_running { - return false; - } - // TODO: an earlier out if world's archetypes did not change for set_idx in conditions.sets_with_conditions_of_systems[system_index] .difference(&self.evaluated_sets) @@ -530,12 +520,7 @@ impl MultiThreadedExecutor { self.active_access .extend(&system_meta.archetype_component_access); - if system_meta.is_send { - scope.spawn(task); - } else { - self.local_thread_running = true; - scope.spawn_on_external(task); - } + scope.spawn(task); } /// # Safety @@ -583,7 +568,7 @@ impl MultiThreadedExecutor { #[cfg(feature = "trace")] let task = task.instrument(task_span); - scope.spawn_on_scope(task); + scope.spawn(task); } else { let task = async move { #[cfg(feature = "trace")] @@ -613,11 +598,10 @@ impl MultiThreadedExecutor { #[cfg(feature = "trace")] let task = task.instrument(task_span); - scope.spawn_on_scope(task); + scope.spawn(task); } self.exclusive_running = true; - self.local_thread_running = true; } fn finish_system_and_handle_dependents(&mut self, result: SystemResult) { @@ -630,10 +614,6 @@ impl MultiThreadedExecutor { self.exclusive_running = false; } - if !self.system_task_metadata[system_index].is_send { - self.local_thread_running = false; - } - debug_assert!(self.num_running_systems >= 1); self.num_running_systems -= 1; self.num_completed_systems += 1;