diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-02-28 13:51:18 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-02-28 13:51:18 -0500 |
commit | db84eaac5ceaa0105422c3185e08a7637e8d97e0 (patch) | |
tree | ba5d33421da410a478194b2245b89137fd7ba005 /src/shell/history/pty.rs | |
parent | c7a9ff6f42f8bab6f3cddc894a9d16812ce4095d (diff) | |
download | nbsh-db84eaac5ceaa0105422c3185e08a7637e8d97e0.tar.gz nbsh-db84eaac5ceaa0105422c3185e08a7637e8d97e0.zip |
convert to std::sync::Mutex and remove a lot of unnecessary async
Diffstat (limited to 'src/shell/history/pty.rs')
-rw-r--r-- | src/shell/history/pty.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/shell/history/pty.rs b/src/shell/history/pty.rs index 499ccc6..2a33e40 100644 --- a/src/shell/history/pty.rs +++ b/src/shell/history/pty.rs @@ -8,7 +8,7 @@ pub struct Pty { impl Pty { pub fn new( size: (u16, u16), - entry: &std::sync::Arc<tokio::sync::Mutex<super::Entry>>, + entry: &std::sync::Arc<std::sync::Mutex<super::Entry>>, input_r: tokio::sync::mpsc::UnboundedReceiver<Vec<u8>>, resize_r: tokio::sync::mpsc::UnboundedReceiver<(u16, u16)>, event_w: crate::shell::event::Writer, @@ -39,7 +39,7 @@ impl Pty { Ok(cmd.spawn(&*self.pts)?) } - pub async fn close(&self) { + pub fn close(&self) { self.close_w.send(()).unwrap(); } } @@ -49,7 +49,7 @@ async fn pty_task( // take the pts here just to ensure that we don't close it before this // task finishes, otherwise the read call can return EIO _pts: std::sync::Arc<pty_process::Pts>, - entry: std::sync::Arc<tokio::sync::Mutex<super::Entry>>, + entry: std::sync::Arc<std::sync::Mutex<super::Entry>>, input_r: tokio::sync::mpsc::UnboundedReceiver<Vec<u8>>, resize_r: tokio::sync::mpsc::UnboundedReceiver<(u16, u16)>, close_r: tokio::sync::mpsc::UnboundedReceiver<()>, @@ -83,7 +83,7 @@ async fn pty_task( match res { Res::Read(res) => match res { Ok(bytes) => { - entry.clone().lock_owned().await.process(&bytes); + entry.lock().unwrap().process(&bytes); event_w.send(Event::PtyOutput); } Err(e) => { |