Fix thread

This commit is contained in:
2023-03-08 15:54:10 +01:00
committed by François Autin
parent ec07158633
commit 75e5c17f28
2 changed files with 10 additions and 33 deletions

View File

@@ -1,13 +1,11 @@
use std::sync::Arc;
use std::{sync::Arc, rc::Rc};
use crate::utility::list::List;
use crate::kernel::thread::Thread;
use super::system::{G_CURRENT_THREAD, G_THREAD_TO_BE_DESTROYED};
#[derive(PartialEq)]
pub struct Scheduler {
ready_list: List<Arc<Thread>>
ready_list: List<Rc<Thread>>
}
impl Scheduler {
@@ -28,7 +26,7 @@ impl Scheduler {
/// ## Pamameter
///
/// **thread** is the thread to be put on the read list
pub fn ready_to_run(&mut self, thread: Arc<Thread>) {
pub fn ready_to_run(&mut self, thread: Rc<Thread>) {
self.ready_list.push(thread);
}
@@ -38,7 +36,7 @@ impl Scheduler {
/// Thread is removed from the ready list.
///
/// **return** Thread thread to be scheduled
pub fn find_next_to_run(&mut self) -> Option<Arc<Thread>> {
pub fn find_next_to_run(&mut self) -> Option<Rc<Thread>> {
self.ready_list.pop()
}