mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-19 04:26:39 +00:00
Use SpinLock
to protect PROCESSOR
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
81cca42205
commit
83c2aba0b0
@ -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>> {
|
||||
|
Reference in New Issue
Block a user