From 013a2968cd816c9dfc3960094a54635085b58a16 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Tue, 28 Feb 2023 16:39:40 +0100 Subject: [PATCH] Add scheduler structure --- src/kernel/scheduler.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/kernel/scheduler.rs b/src/kernel/scheduler.rs index e69de29..34f81f9 100644 --- a/src/kernel/scheduler.rs +++ b/src/kernel/scheduler.rs @@ -0,0 +1,32 @@ +use crate::utility::list::List; +use crate::kernel::thread::Thread; +use std::rc::Rc; + + +struct Scheduler<> { + ready_list: List> +} + +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) { + self.ready_list.push_back(thread); + } + +} \ No newline at end of file