A few documentation updates
This commit is contained in:
parent
81f3ac2099
commit
4ee0c11c56
@ -43,12 +43,12 @@ impl Semaphore {
|
|||||||
machine.interrupt.set_status(old_status);
|
machine.interrupt.set_status(old_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Increment semaphore value, waking up a waiting thread if any.
|
/// Increment semaphore value, waking up a waiting thread if any.
|
||||||
/// As with P(), this operation must be atomic, so we need to disable
|
/// As with P(), this operation must be atomic, so we need to disable
|
||||||
/// interrupts.
|
/// interrupts.
|
||||||
///
|
///
|
||||||
/// scheduler::ready_to_run() assumes that interrupts
|
/// scheduler::ready_to_run() assumes that interrupts
|
||||||
/// are disabled when it is called.
|
/// are disabled when it is called.
|
||||||
///
|
///
|
||||||
/// ### Parameters
|
/// ### Parameters
|
||||||
/// - **machine** the machine where the threads are executed
|
/// - **machine** the machine where the threads are executed
|
||||||
|
@ -6,17 +6,26 @@ use super::{scheduler::Scheduler, thread::Thread, system::System, mgerror::Error
|
|||||||
|
|
||||||
pub const SIMULATORSTACKSIZE: usize = 32 * 1024;
|
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)]
|
#[derive(PartialEq)]
|
||||||
pub struct ThreadManager {
|
pub struct ThreadManager {
|
||||||
|
/// Current running thread
|
||||||
pub g_current_thread: Option<Rc<RefCell<Thread>>>,
|
pub g_current_thread: Option<Rc<RefCell<Thread>>>,
|
||||||
|
/// The thread to be destroyed next
|
||||||
pub g_thread_to_be_destroyed: Option<Rc<RefCell<Thread>>>,
|
pub g_thread_to_be_destroyed: Option<Rc<RefCell<Thread>>>,
|
||||||
|
/// The list of alive threads
|
||||||
pub g_alive: List<Rc<RefCell<Thread>>>,
|
pub g_alive: List<Rc<RefCell<Thread>>>,
|
||||||
|
/// The thread scheduler
|
||||||
pub g_scheduler: Scheduler,
|
pub g_scheduler: Scheduler,
|
||||||
|
/// The system owning the thread manager
|
||||||
pub system: Option<Rc<RefCell<System>>>
|
pub system: Option<Rc<RefCell<System>>>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ThreadManager {
|
impl ThreadManager {
|
||||||
|
|
||||||
|
/// Thread manager constructor
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
g_current_thread: Option::None,
|
g_current_thread: Option::None,
|
||||||
|
Loading…
Reference in New Issue
Block a user