From a82f37fdb0c16f9830b11206cef9d4318e36e12b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 20 Mar 2021 19:20:50 +0000 Subject: [PATCH] clock: Fix spinning Signed-off-by: Ian Jackson --- src/clock.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/clock.rs b/src/clock.rs index aa8faa2d..ce9a065f 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -297,8 +297,6 @@ impl ThreadState { #[throws(IE)] fn run(mut self) { loop { - // xxx this seems to spin - match self.next_wakeup { Some(wakeup) => { let timeout = wakeup - now()?; @@ -341,10 +339,11 @@ impl ThreadState { || internal_error_bydebug(&state) )?.expires - now; state.users[user].remaining = remaining; - Some(libc::timespec { + let pause: TimeSpec = libc::timespec { tv_sec: 0, tv_nsec: remaining.tv_nsec(), - }.into()) + }.into(); + Some(pause + now) } else { None }; -- 2.30.2