Cleanup empty event behavior

This commit is contained in:
Marcin Mielniczuk
2020-01-17 22:26:22 +01:00
parent 5b5f9a7b06
commit 3d29244203

View File

@@ -263,18 +263,9 @@ pub(crate) fn poll_oneoff(
if fd_events.is_empty() {
match timeout {
Some((event, dur)) => return Ok(handle_timeout(event, dur, events)),
// `poll` invoked with nfds = 0, timeout = -1 appears to be an infinite sleep on Unix
// usually meant to be interrupted by a signal. Unfortunately, WASI doesn't currently
// support signals and there is no way to interrupt this infinite sleep, so we
// intend to return `ENOTSUP`.
//
// Unfortunately, current implementation of poll_oneoff on Unix relies on
// `poll_oneoff` returning `Ok(())` in such case, so we emulate this behavior for now
// and will address it in a subsequent PR.
None => {
// error!("poll_oneoff: invoking with neither timeout nor fds not supported");
return Ok(()); // Err(Error::ENOTSUP);
}
// The implementation has to return Ok(()) in this case,
// cf. the comment in src/hostcalls_impl/misc.rs
None => return Ok(()),
}
}