Skip to content

Commit

Permalink
wasm: use thread::sleep on non-wasi wasm too (#4963)
Browse files Browse the repository at this point in the history
Co-authored-by: Taiki Endo <te316e89@gmail.com>
  • Loading branch information
Darksonn and taiki-e committed Sep 1, 2022
1 parent 01ebb0a commit d3cae06
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tokio/src/park/thread.rs
Expand Up @@ -64,10 +64,10 @@ impl Park for ParkThread {
}

fn park_timeout(&mut self, duration: Duration) -> Result<(), Self::Error> {
// Wasi doesn't have threads, so just sleep.
#[cfg(not(tokio_wasi))]
// Wasm doesn't have threads, so just sleep.
#[cfg(not(tokio_wasm))]
self.inner.park_timeout(duration);
#[cfg(tokio_wasi)]
#[cfg(tokio_wasm)]
std::thread::sleep(duration);
Ok(())
}
Expand Down

0 comments on commit d3cae06

Please sign in to comment.