summaryrefslogtreecommitdiff
path: root/engine/src/asset.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-06-01 02:20:57 +0200
committerHampusM <hampus@hampusmat.com>2026-06-01 02:20:57 +0200
commitc0e661a7c9fa2ab9a2be3c26a3913523667e408f (patch)
tree66d147c1e2a5b63b563350976a2df1b9abe800f0 /engine/src/asset.rs
parentc85300fca2c9ece5d3ecd76f0b156b0b53baf6ea (diff)
fix(engine): stop if asset import work queue thread panics
Diffstat (limited to 'engine/src/asset.rs')
-rw-r--r--engine/src/asset.rs13
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
{