diff --git a/framework/jinux-frame/src/sync/wait.rs b/framework/jinux-frame/src/sync/wait.rs index 6be13418c..820015463 100644 --- a/framework/jinux-frame/src/sync/wait.rs +++ b/framework/jinux-frame/src/sync/wait.rs @@ -2,10 +2,11 @@ use core::sync::atomic::{AtomicBool, Ordering}; use alloc::{collections::VecDeque, sync::Arc}; use bitflags::bitflags; -use spin::mutex::Mutex; use crate::task::schedule; +use super::SpinLock; + /// A wait queue. /// /// One may wait on a wait queue to put its executing thread to sleep. @@ -13,14 +14,14 @@ use crate::task::schedule; /// Other threads may invoke the `wake`-family methods of a wait queue to /// wake up one or many waiter threads. pub struct WaitQueue { - waiters: Mutex>>, + waiters: SpinLock>>, } impl WaitQueue { /// Creates a new instance. pub fn new() -> Self { WaitQueue { - waiters: Mutex::new(VecDeque::new()), + waiters: SpinLock::new(VecDeque::new()), } } diff --git a/services/libs/jinux-std/src/device/tty/line_discipline.rs b/services/libs/jinux-std/src/device/tty/line_discipline.rs index c48e63a3e..ea9f63635 100644 --- a/services/libs/jinux-std/src/device/tty/line_discipline.rs +++ b/services/libs/jinux-std/src/device/tty/line_discipline.rs @@ -109,7 +109,7 @@ impl LineDiscipline { if !current_line.is_empty() { current_line.backspace(); } - } else if meet_new_line(item, &self.termios()) { + } else if meet_new_line(item, &termios) { // a new line was met. We currently add the item to buffer. // when we read content, the item should be skipped if it's EOF. let mut current_line = self.current_line.lock(); @@ -129,7 +129,7 @@ impl LineDiscipline { } if termios.contain_echo() { - self.output_char(item); + self.output_char(item, &termios); } if self.is_readable() { @@ -143,12 +143,11 @@ impl LineDiscipline { } // TODO: respect output flags - fn output_char(&self, item: u8) { + fn output_char(&self, item: u8, termios: &KernelTermios) { if 0x20 <= item && item < 0x7f { let ch = char::from(item); print!("{}", ch); } - let termios = self.termios.lock(); if item == *termios.get_special_char(CC_C_CHAR::VERASE) { // write a space to overwrite current character let bytes: [u8; 3] = [b'\x08', b' ', b'\x08'];