bevy/crates/bevy_ecs/src/schedule_v3/executor
Mike e1b0bbf5ed Stageless: add a method to scope to always run a task on the scope thread (#7415)
# Objective

- Currently exclusive systems and applying buffers run outside of the multithreaded executor and just calls the funtions on the thread the schedule is running on. Stageless changes this to run these using tasks in a scope. Specifically It uses `spawn_on_scope` to run these. For the render thread this is incorrect as calling `spawn_on_scope` there runs tasks on the main thread. It should instead run these on the render thread and only run nonsend systems on the main thread.
 
## Solution

- Add another executor to `Scope` for spawning tasks on the scope. `spawn_on_scope` now always runs the task on the thread the scope is running on. `spawn_on_external` spawns onto the external executor than is optionally passed in. If None is passed `spawn_on_external` will spawn onto the scope executor.
- Eventually this new machinery will be able to be removed. This will happen once a fix for removing NonSend resources from the world lands. So this is a temporary fix to support stageless.

---

## Changelog

- add a spawn_on_external method to allow spawning on the scope's thread or an external thread

## Migration Guide

> No migration guide. The main thread executor was introduced in pipelined rendering which was merged for 0.10. spawn_on_scope now behaves the same way as on 0.9.
2023-02-05 21:44:46 +00:00
..
mod.rs Stageless: move MainThreadExecutor to schedule_v3 (#7444) 2023-02-03 03:19:41 +00:00
multi_threaded.rs Stageless: add a method to scope to always run a task on the scope thread (#7415) 2023-02-05 21:44:46 +00:00
simple.rs Add bevy_ecs::schedule_v3 module (#6587) 2023-01-17 01:39:17 +00:00
single_threaded.rs Add bevy_ecs::schedule_v3 module (#6587) 2023-01-17 01:39:17 +00:00