From fe4bbb2fc2f1058e787adde37717128cb3af873a Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Wed, 8 Mar 2023 21:43:03 +0100 Subject: [PATCH] Fix start_thread --- src/kernel/thread_manager.rs | 6 +++--- src/simulator/interrupt.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/kernel/thread_manager.rs b/src/kernel/thread_manager.rs index 28e5eaa..466d14e 100644 --- a/src/kernel/thread_manager.rs +++ b/src/kernel/thread_manager.rs @@ -28,7 +28,7 @@ impl<'a> ThreadManager<'a> { } /// Start a thread, attaching it to a process - pub fn start_thread(&mut self, thread: &mut Thread, owner: Process, func_pc: i64, argument: i64) -> Result<(), ErrorCode> { + pub fn start_thread(&mut self, mut thread: Thread, owner: Process, func_pc: i64, argument: i64) -> Result<(), ErrorCode> { thread.process = Option::Some(owner); let ptr = 0; // todo addrspace thread.init_thread_context(func_pc, ptr, argument); @@ -36,8 +36,8 @@ impl<'a> ThreadManager<'a> { thread.init_simulator_context(base_stack_addr); thread.process.as_mut().unwrap().num_thread += 1; let thread_m = Rc::new(thread); - // self.get_g_alive().push(Rc::clone(thread)); - // self.g_scheduler().ready_to_run(Rc::clone(&thread)); + self.get_g_alive().push(Rc::clone(&thread_m)); + self.g_scheduler().ready_to_run(Rc::clone(&thread_m)); Result::Ok(()) } diff --git a/src/simulator/interrupt.rs b/src/simulator/interrupt.rs index 9cede5b..e63e0af 100644 --- a/src/simulator/interrupt.rs +++ b/src/simulator/interrupt.rs @@ -12,10 +12,10 @@ impl Interrupt { } } - pub fn set_status(&mut self, newStatus: InterruptStatus) -> InterruptStatus { + pub fn set_status(&mut self, new_status: InterruptStatus) -> InterruptStatus { let old = self.level; - self.level = newStatus; - if newStatus == InterruptStatus::InterruptOn && old == InterruptStatus::InterruptOff { + self.level = new_status; + if new_status == InterruptStatus::InterruptOn && old == InterruptStatus::InterruptOff { self.one_tick(1); } old