Use `SpinLock` to protect `PROCESSOR`

This commit is contained in:
Ruihan Li 2024-05-09 01:24:23 +08:00 committed by Tate, Hongliang Tian
parent 81cca42205
commit 83c2aba0b0
1 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ use super::{
task::{context_switch, TaskContext},
Task, TaskStatus,
};
use crate::{cpu_local, sync::Mutex};
use crate::{cpu_local, sync::SpinLock};
pub struct Processor {
current: Option<Arc<Task>>,
@ -39,7 +39,7 @@ impl Processor {
}
lazy_static! {
static ref PROCESSOR: Mutex<Processor> = Mutex::new(Processor::new());
static ref PROCESSOR: SpinLock<Processor> = SpinLock::new(Processor::new());
}
pub fn take_current_task() -> Option<Arc<Task>> {