use std::convert::TryFrom;
use std::io;
-use std::time::Duration;
use std::os::raw::c_int;
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
+use std::time::Duration;
-use crate::tools::Fd;
use crate::error::io_err_other;
+use crate::tools::Fd;
pub type EpollEvent = libc::epoll_event;
pub const EPOLLIN: u32 = libc::EPOLLIN as u32;
+pub const EPOLLET: u32 = libc::EPOLLET as u32;
pub const EPOLLOUT: u32 = libc::EPOLLOUT as u32;
pub const EPOLLERR: u32 = libc::EPOLLERR as u32;
pub const EPOLLHUP: u32 = libc::EPOLLHUP as u32;
Ok(())
}
- pub fn wait(&self, event_buf: &mut [EpollEvent], timeout: Option<Duration>) -> io::Result<usize> {
+ pub fn wait(
+ &self,
+ event_buf: &mut [EpollEvent],
+ timeout: Option<Duration>,
+ ) -> io::Result<usize> {
let millis = timeout
.map(|t| c_int::try_from(t.as_millis()))
.transpose()
use std::task::{Context, Poll, Waker};
use std::thread::JoinHandle;
-use crate::epoll::{Epoll, EpollEvent, EPOLLERR, EPOLLHUP, EPOLLIN, EPOLLOUT};
+use crate::epoll::{Epoll, EpollEvent, EPOLLERR, EPOLLET, EPOLLHUP, EPOLLIN, EPOLLOUT};
use crate::error::io_err_other;
use crate::poll_fn::poll_fn;
use crate::tools::Fd;
inner_ptr as *mut RegistrationInner as usize as u64
};
- self.epoll.add_fd(fd, EPOLLIN | EPOLLOUT, inner_ptr)?;
+ self.epoll
+ .add_fd(fd, EPOLLIN | EPOLLOUT | EPOLLET, inner_ptr)?;
Ok(Registration { inner: Some(inner) })
}