Skip to content

Commit

Permalink
illumos epoll may not wake up unless pipe is empty
Browse files Browse the repository at this point in the history
At present, mio makes use of the emulated epoll(5) available on illumos
systems.  On some versions of illumos the interaction between pipes and
EPOLLET is not quite right.  Specifically, a wakeup may only be
triggered when the buffer pipe transitions from empty to non-empty.  To
work around this, flush the buffer for every call to wake().
  • Loading branch information
jclulow authored and Thomasdezeeuw committed Dec 8, 2020
1 parent 0db49f6 commit 943d424
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sys/unix/waker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ mod pipe {
}

pub fn wake(&self) -> io::Result<()> {
// The epoll emulation on some illumos systems currently requires
// the pipe buffer to be completely empty for an edge-triggered
// wakeup on the pipe read side.
#[cfg(target_os = "illumos")]
self.empty();

match (&self.sender).write(&[1]) {
Ok(_) => Ok(()),
Err(ref err) if err.kind() == io::ErrorKind::WouldBlock => {
Expand Down

0 comments on commit 943d424

Please sign in to comment.