Implement periodic yielding using epoch_deadline_async_yield_and_update

This commit is contained in:
Isaac Clayton 2022-07-12 17:07:33 +02:00
parent 170d27b04c
commit 7f11a32364
3 changed files with 39 additions and 15 deletions

View file

@ -23,7 +23,7 @@ mod tests {
}
async {
let mut runtime = PluginBuilder::new_with_default_ctx()
let (mut runtime, incrementer) = PluginBuilder::new_with_default_ctx()
.unwrap()
.host_function("mystery_number", |input: u32| input + 7)
.unwrap()
@ -53,6 +53,8 @@ mod tests {
.await
.unwrap();
std::thread::spawn(move || incrementer.block_on());
let plugin = TestPlugin {
noop: runtime.function("noop").unwrap(),
constant: runtime.function("constant").unwrap(),