mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 12:34:31 +00:00
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 <nkgold@google.com> Reviewed-by: Dennis Kempin <denniskempin@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
fb874a8a9f
commit
dc8d1dbdca
1 changed files with 7 additions and 1 deletions
|
@ -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<u64> {
|
||||
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)?;
|
||||
|
|
Loading…
Reference in a new issue