Add thread_finish

This commit is contained in:
Quentin Legot 2023-03-14 22:01:52 +01:00
parent aef8b18966
commit 88a0b31300

View File

@ -103,8 +103,18 @@ impl ThreadManager {
} }
/// Finish the execution of the thread and prepare its deallocation /// Finish the execution of the thread and prepare its deallocation
pub fn thread_finish(&self, thread: Rc<RefCell<Thread>>) { pub fn thread_finish(&mut self, thread: Rc<RefCell<Thread>>) {
todo!(); if let Some(system) = &self.system {
let sys = Rc::clone(system);
let sys = sys.borrow_mut();
let mut machine = sys.get_g_machine().borrow_mut();
let old_status = machine.interrupt.set_status(InterruptStatus::InterruptOff);
self.g_thread_to_be_destroyed = Option::Some(Rc::clone(&thread));
self.g_alive.remove(Rc::clone(&thread));
// g_objets_addrs->removeObject(self.thread) // a ajouté plus tard
self.thread_sleep(Rc::clone(&thread));
machine.interrupt.set_status(old_status);
}
} }
pub fn thread_save_processor_state(&mut self, thread: Rc<RefCell<Thread>>) { pub fn thread_save_processor_state(&mut self, thread: Rc<RefCell<Thread>>) {