wasm: use thread::sleep on non-wasi wasm too (#4963)

Co-authored-by: Taiki Endo <[email protected]>
This commit is contained in:
Alice Ryhl
2022-09-01 16:52:56 +02:00
committed by GitHub
co-authored by Taiki Endo
parent 01ebb0aa29
commit d3cae06b5e
+3 -3
View File
@@ -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(())
}