diff options
Diffstat (limited to 'engine/src/asset.rs')
| -rw-r--r-- | engine/src/asset.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/engine/src/asset.rs b/engine/src/asset.rs index 95d9dc3..d22b3f1 100644 --- a/engine/src/asset.rs +++ b/engine/src/asset.rs @@ -6,6 +6,7 @@ use std::convert::Infallible; use std::ffi::{OsStr, OsString}; use std::fmt::{Debug, Display}; use std::hash::{DefaultHasher, Hash, Hasher}; +use std::hint::cold_path; use std::marker::PhantomData; use std::path::{Path, PathBuf}; use std::sync::mpsc::{ @@ -15,6 +16,8 @@ use std::sync::mpsc::{ }; use std::sync::Arc; +use ecs::actions::Actions; + use crate::ecs::pair::{ChildOf, Pair}; use crate::ecs::phase::{Phase, PRE_UPDATE as PRE_UPDATE_PHASE}; use crate::ecs::sole::Single; @@ -851,6 +854,7 @@ impl crate::ecs::extension::Extension for Extension collector.add_declared_entity(&HANDLE_ASSETS_PHASE); collector.add_system(*HANDLE_ASSETS_PHASE, add_received_assets); + collector.add_system(*HANDLE_ASSETS_PHASE, check_import_wq_thread_not_panicked); } } @@ -881,6 +885,15 @@ fn add_received_assets(mut assets: Single<Assets>) } } +fn check_import_wq_thread_not_panicked(assets: Single<Assets>, mut actions: Actions<'_>) +{ + if assets.import_work_queue.get_thread_panic().is_some() { + cold_path(); + + actions.stop(); + } +} + #[derive(Debug)] struct ImportWorkUserData { |
