Add a sleep function to the WasiSched trait.

This commit is contained in:
Dan Gohman
2021-03-22 11:23:45 -07:00
parent dd7e16762c
commit 2880dab8f8
5 changed files with 32 additions and 2 deletions

View File

@@ -108,6 +108,9 @@ impl WasiSched for SyncSched {
std::thread::yield_now();
Ok(())
}
fn sleep(&self, duration: Duration) {
std::thread::sleep(duration)
}
}
fn wasi_file_raw_fd(f: &dyn WasiFile) -> Option<RawFd> {

View File

@@ -128,6 +128,9 @@ impl WasiSched for SyncSched {
thread::yield_now();
Ok(())
}
fn sleep(&self, duration: Duration) {
std::thread::sleep(duration)
}
}
fn wasi_file_raw_handle(f: &dyn WasiFile) -> Option<RawHandle> {