diff --git a/src/kernel/thread_manager.rs b/src/kernel/thread_manager.rs index 6878c63..870a9fc 100644 --- a/src/kernel/thread_manager.rs +++ b/src/kernel/thread_manager.rs @@ -79,6 +79,7 @@ impl ThreadManager { self.debug(format!("switching from \"{}\" to \"{}\"", old2.borrow().get_name(), next_thread.borrow().get_name())); self.thread_restore_processor_state(machine, Rc::clone(&next_thread)); // next_thread.restore_simulator_state(); + debug_assert!(!self.ready_list.contains(&next_thread)); self.set_g_current_thread(Some(next_thread)); } }, @@ -111,6 +112,7 @@ impl ThreadManager { pub fn thread_join(&mut self, machine: &mut Machine, waiter: Rc>, waiting_for: Rc>) { let waiting_for = Rc::clone(&waiting_for); while self.get_g_alive().contains(&waiting_for) { + self.debug(format!("Joining \"{}\" to \"{}\"", waiter.borrow().get_name(), waiting_for.borrow().get_name())); self.thread_yield(machine, Rc::clone(&waiter)); } }