From 83c2aba0b00ef231379c3ce9ebd4577f859b3a6c Mon Sep 17 00:00:00 2001 From: Ruihan Li Date: Thu, 9 May 2024 01:24:23 +0800 Subject: [PATCH] Use `SpinLock` to protect `PROCESSOR` --- framework/aster-frame/src/task/processor.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/aster-frame/src/task/processor.rs b/framework/aster-frame/src/task/processor.rs index a29562bb8..6d0391112 100644 --- a/framework/aster-frame/src/task/processor.rs +++ b/framework/aster-frame/src/task/processor.rs @@ -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>, @@ -39,7 +39,7 @@ impl Processor { } lazy_static! { - static ref PROCESSOR: Mutex = Mutex::new(Processor::new()); + static ref PROCESSOR: SpinLock = SpinLock::new(Processor::new()); } pub fn take_current_task() -> Option> {