mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-21 08:26:30 +00:00
Replace Mutex with Spinlock in tty to avoid deadlock
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
2b59a406a6
commit
2985cdced6
@ -12,8 +12,10 @@ use core::{
|
||||
ops::{Index, IndexMut},
|
||||
};
|
||||
use font8x8::UnicodeFonts;
|
||||
use jinux_frame::{config::PAGE_SIZE, mmio::Mmio, vm::VmIo, LimineFramebufferRequest};
|
||||
use spin::{Mutex, Once};
|
||||
use jinux_frame::{
|
||||
config::PAGE_SIZE, mmio::Mmio, sync::SpinLock, vm::VmIo, LimineFramebufferRequest,
|
||||
};
|
||||
use spin::Once;
|
||||
|
||||
#[init_component]
|
||||
fn framebuffer_init() -> Result<(), ComponentInitError> {
|
||||
@ -21,7 +23,7 @@ fn framebuffer_init() -> Result<(), ComponentInitError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) static WRITER: Once<Mutex<Writer>> = Once::new();
|
||||
pub(crate) static WRITER: Once<SpinLock<Writer>> = Once::new();
|
||||
static FRAMEBUFFER_REUEST: LimineFramebufferRequest = LimineFramebufferRequest::new(0);
|
||||
|
||||
pub(crate) fn init() {
|
||||
@ -64,7 +66,7 @@ pub(crate) fn init() {
|
||||
};
|
||||
writer.clear();
|
||||
|
||||
WRITER.call_once(|| Mutex::new(writer));
|
||||
WRITER.call_once(|| SpinLock::new(writer));
|
||||
}
|
||||
|
||||
pub(crate) struct Writer {
|
||||
|
Reference in New Issue
Block a user