Remove old static vars in scheduler, doesn't work
This commit is contained in:
parent
75e5c17f28
commit
3406544e3b
@ -1,8 +1,10 @@
|
||||
use std::{sync::Arc, rc::Rc};
|
||||
use std::rc::Rc;
|
||||
|
||||
use crate::utility::list::List;
|
||||
use crate::kernel::thread::Thread;
|
||||
|
||||
use super::system::System;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub struct Scheduler {
|
||||
ready_list: List<Rc<Thread>>
|
||||
@ -50,34 +52,16 @@ impl Scheduler {
|
||||
/// ## Parameter
|
||||
///
|
||||
/// **next_thread** thread to dispatch to the CPU
|
||||
pub fn switch_to(&self, next_thread: Thread) {
|
||||
match G_CURRENT_THREAD.write() {
|
||||
Ok(mut current_thread) => {
|
||||
let old_thread = current_thread.as_mut().unwrap();
|
||||
|
||||
pub fn switch_to(&self, system: Rc<System>, next_thread: Thread) {
|
||||
/* if let Some(old_thread) = system.get_g_current_thread() {
|
||||
old_thread.save_processor_state();
|
||||
old_thread.save_simulator_state();
|
||||
|
||||
if old_thread != &next_thread {
|
||||
next_thread.restore_processor_state();
|
||||
next_thread.restore_simulator_state();
|
||||
current_thread.replace(next_thread);
|
||||
}
|
||||
|
||||
match G_THREAD_TO_BE_DESTROYED.write() {
|
||||
Ok(mut thread_to_be_destroyed) => {
|
||||
if thread_to_be_destroyed.is_some() {
|
||||
drop(thread_to_be_destroyed.take());
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
panic!("RwLock is poisonned: {}", err);
|
||||
}
|
||||
}
|
||||
},
|
||||
Err(err) => {
|
||||
panic!("RwLock is poisonned: {}", err);
|
||||
}
|
||||
system.set_g_current_thread(Option::Some(next_thread));
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user