Add scheduler structure

This commit is contained in:
Quentin Legot 2023-02-28 16:39:40 +01:00
parent e422e65767
commit 013a2968cd

View File

@ -0,0 +1,32 @@
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);
}
}