burritos/src/kernel/scheduler.rs

32 lines
691 B
Rust
Raw Normal View History

2023-02-28 16:39:40 +01:00
use crate::utility::list::List;
use crate::kernel::thread::Thread;
use std::rc::Rc;
struct Scheduler<> {
ready_list: List<Rc<Thread>>
}
impl Scheduler {
/// Constructor
///
/// Initilize the list of ready thread
pub fn new() -> Self {
Self {
ready_list: List::new()
}
}
/// Mark a thread as aready, but not necessarily running yet.
///
/// Put it in the ready list, for later scheduling onto the CPU.
///
/// ## Pamameter
///
/// **thread**: Thread is the thread to be put on the read list
pub fn ready_to_run(&mut self, thread: Rc<Thread>) {
self.ready_list.push_back(thread);
}
}