Fix thread
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user