scaffold a scheduler

This commit is contained in:
Pat Hickey
2021-01-12 12:07:00 -08:00
parent e7018bf6e0
commit 0e42c2e1d9
5 changed files with 27 additions and 4 deletions

View File

@@ -0,0 +1,20 @@
use crate::Error;
pub trait WasiSched {
// XXX poll oneoff needs args and results.
fn poll_oneoff(&self) -> Result<(), Error>;
fn sched_yield(&self) -> Result<(), Error>;
}
#[derive(Default)]
pub struct SyncSched {}
impl WasiSched for SyncSched {
fn poll_oneoff(&self) -> Result<(), Error> {
todo!()
}
fn sched_yield(&self) -> Result<(), Error> {
std::thread::yield_now();
Ok(())
}
}