From f586c56a0b3b36bb1d61b5d9b109e8bd226a91b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Thu, 9 Mar 2023 13:33:00 +0100 Subject: [PATCH] Put default thread name in a const --- src/kernel/thread.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/kernel/thread.rs b/src/kernel/thread.rs index d4aedbc..298df68 100644 --- a/src/kernel/thread.rs +++ b/src/kernel/thread.rs @@ -104,17 +104,18 @@ fn start_thread_execution() { mod test { use super::{Thread, ThreadContext, NUM_INT_REGS, NUM_FP_REGS, ObjectType}; + const DEFAULT_THREAD_NAME: &str = "test_thread"; macro_rules! get_new_thread { - () => { Thread::new("test_thread") }; + () => { Thread::new(DEFAULT_THREAD_NAME) }; ($a:literal) => { Thread::new(&$a.to_string()) }; } macro_rules! expected_initial_state { - () => { expected_initial_state!("test_thread") }; - ($a:literal) => { { + () => { expected_initial_state!(DEFAULT_THREAD_NAME) }; + ($a:expr) => { { let mut x = Thread::new($a); x.name = $a.to_string(); x.process = Option::None;