From d3cae06b5ef854f6dbd38a259ed4fe4811c75d00 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Thu, 1 Sep 2022 16:52:56 +0200 Subject: [PATCH] wasm: use `thread::sleep` on non-wasi wasm too (#4963) Co-authored-by: Taiki Endo --- tokio/src/park/thread.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tokio/src/park/thread.rs b/tokio/src/park/thread.rs index 7b35ba38e..4db1c1b31 100644 --- a/tokio/src/park/thread.rs +++ b/tokio/src/park/thread.rs @@ -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(()) }