From 74096eb9f68af7c0cc7c2e3263b4b040b982a37b Mon Sep 17 00:00:00 2001 From: lyken Date: Tue, 25 Jun 2024 12:36:37 +0800 Subject: [PATCH] core: name codegen worker threads --- nac3core/src/codegen/mod.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nac3core/src/codegen/mod.rs b/nac3core/src/codegen/mod.rs index 1103039d..eb3b9d95 100644 --- a/nac3core/src/codegen/mod.rs +++ b/nac3core/src/codegen/mod.rs @@ -273,9 +273,15 @@ impl WorkerRegistry { let registry = registry.clone(); let registry2 = registry.clone(); let f = f.clone(); - let handle = thread::spawn(move || { - registry.worker_thread(generator.as_mut(), &f); - }); + + let worker_thread_name = + format!("codegen-worker-{worker_id}", worker_id = generator.get_name()); + let handle = thread::Builder::new() + .name(worker_thread_name) + .spawn(move || { + registry.worker_thread(generator.as_mut(), &f); + }) + .unwrap(); let handle = thread::spawn(move || { if let Err(e) = handle.join() { if let Some(e) = e.downcast_ref::<&'static str>() {