1
0
forked from Rativel/BurritOS

update synch.rs

This commit is contained in:
Samy Solhi
2023-03-15 16:28:29 +01:00
parent 1906ec836c
commit b22b1dea21
4 changed files with 87 additions and 58 deletions

View File

@@ -6,7 +6,7 @@ use std::{cell::RefCell, rc::Rc};
use crate::simulator::machine::Machine;
use super::thread_manager::ThreadManager;
use super::{thread_manager::ThreadManager, thread::Thread};
/// This macro properly initializes the system
#[macro_export]
@@ -46,17 +46,23 @@ impl System {
}
}
/// Sets a thread asleep
///
pub fn thread_sleep(&mut self, thread: Rc<RefCell<Thread>>) {
&self.thread_manager.thread_sleep(self, thread);
}
// GETTERS
/// Returns the Machine
///
/// Useful to access RAM, devices, ...
pub fn get_machine(&self) -> &Machine {
&self.machine
pub fn get_machine(&mut self) -> &mut Machine {
&mut self.machine
}
pub fn get_thread_manager(&self) -> &ThreadManager {
&self.thread_manager
pub fn get_thread_manager(&mut self) -> &mut ThreadManager {
&mut self.thread_manager
}
// Setters