From dc8d1dbdca6fa94e754f175a714c28fc7e623474 Mon Sep 17 00:00:00 2001 From: Noah Gold Date: Fri, 29 Apr 2022 11:22:10 -0700 Subject: [PATCH] cros_async: update Timer & sleep docs for Windows. base::Timer's sleep may wake early on Windows, which has knockon effects here where we consume it. BUG=b:229680949 TEST=n/a Change-Id: I44a8f78e3dbc01ef562101c2706b89d2a88e5bf7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617161 Commit-Queue: Noah Gold Reviewed-by: Dennis Kempin Tested-by: kokoro --- cros_async/src/timer.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cros_async/src/timer.rs b/cros_async/src/timer.rs index 269dbb303a..dd688a63f6 100644 --- a/cros_async/src/timer.rs +++ b/cros_async/src/timer.rs @@ -18,11 +18,17 @@ impl TimerAsync { } /// Gets the next value from the timer. + /// + /// NOTE: on Windows, this may return/wake early. See `base::Timer` docs + /// for details. pub async fn next_val(&self) -> AsyncResult { self.io_source.wait_for_handle().await } - /// Async sleep for the given duration + /// Async sleep for the given duration. + /// + /// NOTE: on Windows, this sleep may wake early. See `base::Timer` docs + /// for details. pub async fn sleep(ex: &Executor, dur: Duration) -> std::result::Result<(), Error> { let mut tfd = Timer::new().map_err(Error::Timer)?; tfd.reset(dur, None).map_err(Error::Timer)?;