Do not loop with nfds=0, timeout=-1
This commit is contained in:
@@ -125,18 +125,13 @@ pub(crate) fn poll_oneoff(
|
|||||||
// With no events to listen, poll_oneoff just becomes a sleep.
|
// With no events to listen, poll_oneoff just becomes a sleep.
|
||||||
if fd_events.is_empty() {
|
if fd_events.is_empty() {
|
||||||
match timeout_duration {
|
match timeout_duration {
|
||||||
Some(t) => {
|
Some(t) => thread::sleep(t),
|
||||||
thread::sleep(t);
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
None => {
|
|
||||||
// `poll` invoked with nfds = 0, timeout = -1 appears to be an infinite sleep
|
// `poll` invoked with nfds = 0, timeout = -1 appears to be an infinite sleep
|
||||||
// The thread is not guanteed to remain parked forever, so we need to loop
|
// Even though the thread is not guanteed to remain parked forever, `poll(2)`
|
||||||
loop {
|
// mentions that spurious readiness notifications may occur, so it's probably fine
|
||||||
thread::park();
|
None => thread::park(),
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currently WASI file support is only (a) regular files (b) directories (c) symlinks on Windows,
|
// Currently WASI file support is only (a) regular files (b) directories (c) symlinks on Windows,
|
||||||
|
|||||||
Reference in New Issue
Block a user