//! # System module //! //! Module containing structs and methods pertaining to the state of the operating system use super::{thread_manager::ThreadManager}; use crate::utility; use crate::utility::objaddr::{ObjAddr, SynchObj}; /// # System /// /// This structure represents the state of the threads running on the operating system. /// It contains references to the following: /// /// - The simulated machine /// - The current running thread /// - The list of active threads /// - The thread to be destroyed next /// - The scheduler which acts upon these threads pub struct System<'a> { thread_manager: ThreadManager, obj_addrs: ObjAddr<'a> } impl<'a> System<'a> { // GETTERS pub fn get_thread_manager(&mut self) -> &mut ThreadManager { &mut self.thread_manager } pub fn get_obj_addrs(&mut self) -> &'a mut ObjAddr { &mut self.obj_addrs } } impl<'a> Default for System<'a> { /// System constructor fn default() -> Self { Self { thread_manager: ThreadManager::new(), obj_addrs: ObjAddr::init() } } } #[derive(PartialEq, Debug)] pub enum ObjectType { SemaphoreType, LockType, ConditionType, FileType, ThreadType, InvalidType }