aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/task_pool.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2023-03-07 14:14:36 -0600
committerGitHub <noreply@github.com>2023-03-07 14:14:36 -0600
commit719379a8a76ab0685f2bd14bebe2f0cd1e97f06b (patch)
treece5d6c62bc36fb1d1ec31083bc8e81a0109c12df /azalea-client/src/task_pool.rs
parentbf4ff517890cad3ff4e36b4b78959504192e5374 (diff)
downloadazalea-drasl-719379a8a76ab0685f2bd14bebe2f0cd1e97f06b.tar.xz
Bevy 0.10 (#79)
* replace 0.9.1 with 0.10.0 * start migrating to bevy .10 * well it compiles * doesn't immediately panic * remove unused imports * fmt * delete azalea-ecs * make RelativeEntityUpdate an EntityCommand * fix a doc test * explain what FixedUpdate does
Diffstat (limited to 'azalea-client/src/task_pool.rs')
-rw-r--r--azalea-client/src/task_pool.rs26
1 files changed, 17 insertions, 9 deletions
diff --git a/azalea-client/src/task_pool.rs b/azalea-client/src/task_pool.rs
index 59f70487..8df554f0 100644
--- a/azalea-client/src/task_pool.rs
+++ b/azalea-client/src/task_pool.rs
@@ -1,11 +1,16 @@
//! Borrowed from `bevy_core`.
-use azalea_ecs::{
- app::{App, Plugin},
- schedule::IntoSystemDescriptor,
- system::Resource,
+use std::marker::PhantomData;
+
+use bevy_app::{App, CoreSet, Plugin};
+use bevy_ecs::{
+ schedule::IntoSystemConfig,
+ system::{NonSend, Resource},
+};
+use bevy_tasks::{
+ tick_global_task_pools_on_main_thread, AsyncComputeTaskPool, ComputeTaskPool, IoTaskPool,
+ TaskPoolBuilder,
};
-use bevy_tasks::{AsyncComputeTaskPool, ComputeTaskPool, IoTaskPool, TaskPoolBuilder};
/// Setup of default task pools: `AsyncComputeTaskPool`, `ComputeTaskPool`,
/// `IoTaskPool`.
@@ -22,13 +27,16 @@ impl Plugin for TaskPoolPlugin {
self.task_pool_options.create_default_pools();
#[cfg(not(target_arch = "wasm32"))]
- app.add_system_to_stage(
- azalea_ecs::app::CoreStage::Last,
- bevy_tasks::tick_global_task_pools_on_main_thread.at_end(),
- );
+ app.add_system(tick_global_task_pools.in_base_set(CoreSet::Last));
}
}
+pub struct NonSendMarker(PhantomData<*mut ()>);
+#[cfg(not(target_arch = "wasm32"))]
+fn tick_global_task_pools(_main_thread_marker: Option<NonSend<NonSendMarker>>) {
+ tick_global_task_pools_on_main_thread();
+}
+
/// Helper for configuring and creating the default task pools. For end-users
/// who want full control, set up [`TaskPoolPlugin`](TaskPoolPlugin)
#[derive(Clone, Resource)]