More work on transitioning to async, need to figure out when to stop

This commit is contained in:
Isaac Clayton
2022-07-07 15:38:28 +02:00
parent feb6cf6789
commit f4b4212932
8 changed files with 109 additions and 113 deletions
+2 -5
View File
@@ -66,15 +66,11 @@ impl PluginBuilder {
/// Create a new [`PluginBuilder`] with the given WASI context.
/// Using the default context is a safe bet, see [`new_with_default_context`].
pub fn new(wasi_ctx: WasiCtx) -> Result<Self, Error> {
dbg!("new plugin");
let mut config = Config::default();
config.async_support(true);
dbg!("Creating engine");
let start = std::time::Instant::now();
config.epoch_interruption(true);
let engine = Engine::new(&config)?;
dbg!(start.elapsed());
let linker = Linker::new(&engine);
dbg!(start.elapsed());
Ok(PluginBuilder {
// host_functions: HashMap::new(),
@@ -317,6 +313,7 @@ impl Plugin {
alloc: None,
},
);
// store.epoch_deadline_async_yield_and_update(todo!());
let module = Module::new(&engine, module)?;
// load the provided module into the asynchronous runtime