wasi: make WasiSched::sleep fallible

some systems do not support sleeping and may want to return EINVAL here.
This commit is contained in:
Pat Hickey
2021-03-23 10:17:48 -07:00
parent 49ef2c652a
commit 81dfb9c458
5 changed files with 9 additions and 9 deletions

View File

@@ -749,8 +749,7 @@ impl<'a> wasi_unstable::WasiUnstable for WasiCtx {
.flags
.contains(types::Subclockflags::SUBSCRIPTION_CLOCK_ABSTIME)
{
self.sched.sleep(Duration::from_nanos(clocksub.timeout));
self.sched.sleep(Duration::from_nanos(clocksub.timeout))?;
events.write(types::Event {
userdata: sub.userdata,
error: types::Errno::Success,

View File

@@ -920,8 +920,7 @@ impl<'a> wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiCtx {
.flags
.contains(types::Subclockflags::SUBSCRIPTION_CLOCK_ABSTIME)
{
self.sched.sleep(Duration::from_nanos(clocksub.timeout));
self.sched.sleep(Duration::from_nanos(clocksub.timeout))?;
events.write(types::Event {
userdata: sub.userdata,
error: types::Errno::Success,