From 4ee0c11c565194aae050ed72e57306632e0fc31e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Autin?= Date: Tue, 14 Mar 2023 15:16:40 +0100 Subject: [PATCH] A few documentation updates --- src/kernel/synch.rs | 8 ++++---- src/kernel/thread_manager.rs | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/kernel/synch.rs b/src/kernel/synch.rs index e7b9ac2..88f5d69 100644 --- a/src/kernel/synch.rs +++ b/src/kernel/synch.rs @@ -43,12 +43,12 @@ impl Semaphore { machine.interrupt.set_status(old_status); } - /// Increment semaphore value, waking up a waiting thread if any. - /// As with P(), this operation must be atomic, so we need to disable - /// interrupts. + /// Increment semaphore value, waking up a waiting thread if any. + /// As with P(), this operation must be atomic, so we need to disable + /// interrupts. /// /// scheduler::ready_to_run() assumes that interrupts - /// are disabled when it is called. + /// are disabled when it is called. /// /// ### Parameters /// - **machine** the machine where the threads are executed diff --git a/src/kernel/thread_manager.rs b/src/kernel/thread_manager.rs index b4d5632..0c65b85 100644 --- a/src/kernel/thread_manager.rs +++ b/src/kernel/thread_manager.rs @@ -6,17 +6,26 @@ use super::{scheduler::Scheduler, thread::Thread, system::System, mgerror::Error pub const SIMULATORSTACKSIZE: usize = 32 * 1024; +/// # Thread manager +/// +/// An instance of this struct is responsible for managing threads on behalf of the system #[derive(PartialEq)] pub struct ThreadManager { + /// Current running thread pub g_current_thread: Option>>, + /// The thread to be destroyed next pub g_thread_to_be_destroyed: Option>>, + /// The list of alive threads pub g_alive: List>>, + /// The thread scheduler pub g_scheduler: Scheduler, + /// The system owning the thread manager pub system: Option>> } impl ThreadManager { + /// Thread manager constructor pub fn new() -> Self { Self { g_current_thread: Option::None,