From b379305631254429427b09f29e15ff62b9d64d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Wed, 15 Mar 2023 11:05:01 +0100 Subject: [PATCH] :art: Exported get_new_thread macro out of thread mod --- src/kernel/thread.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/kernel/thread.rs b/src/kernel/thread.rs index 6cc9332..1352c7a 100644 --- a/src/kernel/thread.rs +++ b/src/kernel/thread.rs @@ -3,6 +3,15 @@ use crate::{simulator::machine::{NUM_INT_REGS, NUM_FP_REGS, STACK_REG}}; const STACK_FENCEPOST: u32 = 0xdeadbeef; +/// Polymorphic macro to get thread without passing a name by default +#[macro_export] +macro_rules! get_new_thread { + () => { Thread::new(DEFAULT_THREAD_NAME) }; + ($a:literal) => { + Thread::new(&$a.to_string()) + }; +} + #[derive(PartialEq, Debug)] pub struct ThreadContext { pub int_registers: [i64; NUM_INT_REGS], @@ -102,14 +111,6 @@ mod test { use super::{Thread, ThreadContext, NUM_INT_REGS, NUM_FP_REGS, ObjectType}; const DEFAULT_THREAD_NAME: &str = "test_thread"; - /// Polymorphic macro to get thread without passing a name by default - macro_rules! get_new_thread { - () => { Thread::new(DEFAULT_THREAD_NAME) }; - ($a:literal) => { - Thread::new(&$a.to_string()) - }; - } - /// This macro allows for getting a Thread for which we've ensured proper initial state /// in case a commit further down the line changes the initial state of threads generated /// from Thread::new