implemented getter for objaddr

This commit is contained in:
Rémi Rativel 2023-04-05 16:43:09 +02:00
parent f246e84f91
commit f79b63e930

View File

@ -3,6 +3,8 @@
//! Module containing structs and methods pertaining to the state of the operating system //! Module containing structs and methods pertaining to the state of the operating system
use super::{thread_manager::ThreadManager}; use super::{thread_manager::ThreadManager};
use crate::utility;
use crate::utility::objaddr::{ObjAddr, SynchObj};
/// # System /// # System
/// ///
@ -14,12 +16,12 @@ use super::{thread_manager::ThreadManager};
/// - The list of active threads /// - The list of active threads
/// - The thread to be destroyed next /// - The thread to be destroyed next
/// - The scheduler which acts upon these threads /// - The scheduler which acts upon these threads
#[derive(PartialEq)] pub struct System<'a> {
pub struct System { thread_manager: ThreadManager,
thread_manager: ThreadManager obj_addrs: ObjAddr<'a>
} }
impl System { impl<'a> System<'a> {
// GETTERS // GETTERS
@ -27,12 +29,14 @@ impl System {
&mut self.thread_manager &mut self.thread_manager
} }
pub fn get_obj_addrs(&mut self) -> &'a mut ObjAddr { &mut self.obj_addrs }
} }
impl Default for System { impl<'a> Default for System<'a> {
/// System constructor /// System constructor
fn default() -> Self { fn default() -> Self {
Self { thread_manager: ThreadManager::new() } Self { thread_manager: ThreadManager::new(), obj_addrs: ObjAddr::init() }
} }
} }