diff --git a/examples/ctrl-c.rs b/examples/ctrl-c.rs index d7f070f..d8decb8 100644 --- a/examples/ctrl-c.rs +++ b/examples/ctrl-c.rs @@ -20,7 +20,7 @@ fn main() { smol::run(async { println!("Waiting for Ctrl-C..."); - // Receive a message that indicates the Ctrl-C signal occured. + // Receive a message that indicates the Ctrl-C signal occurred. ctrl_c.recv().await; println!("Done!"); diff --git a/examples/unix-signal.rs b/examples/unix-signal.rs index b437e34..5c2874a 100644 --- a/examples/unix-signal.rs +++ b/examples/unix-signal.rs @@ -20,7 +20,7 @@ fn main() -> std::io::Result<()> { signal_hook::pipe::register(signal_hook::SIGINT, a)?; println!("Waiting for Ctrl-C..."); - // Receive a byte that indicates the Ctrl-C signal occured. + // Receive a byte that indicates the Ctrl-C signal occurred. b.read_exact(&mut [0]).await?; println!("Done!"); diff --git a/src/multitask.rs b/src/multitask.rs index a8b97b8..ca9cc3a 100644 --- a/src/multitask.rs +++ b/src/multitask.rs @@ -346,6 +346,7 @@ impl Worker { self.global.queue.push(err.into_inner()).unwrap(); self.global.notify(); } + self.local.flush().unwrap(); } return true; diff --git a/src/reactor.rs b/src/reactor.rs index ac9c5e3..7ab7b9b 100644 --- a/src/reactor.rs +++ b/src/reactor.rs @@ -251,13 +251,16 @@ impl ReactorLock<'_> { // Block on I/O events. match self.reactor.sys.wait(&mut self.events, timeout) { - // The timeout was hit so fire ready timers. + // No I/O events occurred. Ok(0) => { - self.reactor.fire_timers(); + if timeout != Some(Duration::from_secs(0)) { + // The non-zero timeout was hit so fire ready timers. + self.reactor.fire_timers(); + } Ok(()) } - // At least one I/O event occured. + // At least one I/O event occurred. Ok(_) => { // Iterate over sources in the event list. let sources = self.reactor.sources.lock();