mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-21 00:00:10 +02:00
wasm: use thread::sleep on non-wasi wasm too (#4963)
Co-authored-by: Taiki Endo <[email protected]>
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user