diff options
author | John Nunley <jtnunley01@gmail.com> | 2023-10-07 12:56:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-07 19:56:11 +0000 |
commit | c2f8abecfbaf6b6388e7746b733b7f22cbb7a750 (patch) | |
tree | 3b8e3cb638d25346f7147001ee57cffa46d52f80 /alacritty_terminal/src/tty/mod.rs | |
parent | ace987f343649ae98e5fb63cf825414855ccd86e (diff) | |
download | alacritty-c2f8abecfbaf6b6388e7746b733b7f22cbb7a750.tar.gz alacritty-c2f8abecfbaf6b6388e7746b733b7f22cbb7a750.zip |
Port from mio to polling
This patch replaces the mio crate with the polling. Now that
smol-rs/polling#96 has been merged, we should be at full feature parity
with mio v0.6 now.
Fixes #7104.
Fixes #6486.
Diffstat (limited to 'alacritty_terminal/src/tty/mod.rs')
-rw-r--r-- | alacritty_terminal/src/tty/mod.rs | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/alacritty_terminal/src/tty/mod.rs b/alacritty_terminal/src/tty/mod.rs index 4ce277b3..315f008c 100644 --- a/alacritty_terminal/src/tty/mod.rs +++ b/alacritty_terminal/src/tty/mod.rs @@ -1,10 +1,13 @@ //! TTY related functionality. use std::path::PathBuf; +use std::sync::Arc; use std::{env, io}; use crate::config::Config; +use polling::{Event, PollMode, Poller}; + #[cfg(not(windows))] mod unix; #[cfg(not(windows))] @@ -22,20 +25,15 @@ pub trait EventedReadWrite { type Reader: io::Read; type Writer: io::Write; - fn register( - &mut self, - _: &mio::Poll, - _: &mut dyn Iterator<Item = mio::Token>, - _: mio::Ready, - _: mio::PollOpt, - ) -> io::Result<()>; - fn reregister(&mut self, _: &mio::Poll, _: mio::Ready, _: mio::PollOpt) -> io::Result<()>; - fn deregister(&mut self, _: &mio::Poll) -> io::Result<()>; + /// # Safety + /// + /// The underlying sources must outlive their registration in the `Poller`. + unsafe fn register(&mut self, _: &Arc<Poller>, _: Event, _: PollMode) -> io::Result<()>; + fn reregister(&mut self, _: &Arc<Poller>, _: Event, _: PollMode) -> io::Result<()>; + fn deregister(&mut self, _: &Arc<Poller>) -> io::Result<()>; fn reader(&mut self) -> &mut Self::Reader; - fn read_token(&self) -> mio::Token; fn writer(&mut self) -> &mut Self::Writer; - fn write_token(&self) -> mio::Token; } /// Events concerning TTY child processes. @@ -51,8 +49,6 @@ pub enum ChildEvent { /// notified if the PTY child process does something we care about (other than writing to the TTY). /// In particular, this allows for race-free child exit notification on UNIX (cf. `SIGCHLD`). pub trait EventedPty: EventedReadWrite { - fn child_event_token(&self) -> mio::Token; - /// Tries to retrieve an event. /// /// Returns `Some(event)` on success, or `None` if there are no events to retrieve. |