Stream: git-wasmtime

Topic: wasmtime / issue #8128 Question: how does wasm threading/...


view this post on Zulip Wasmtime GitHub notifications bot (Mar 14 2024 at 00:42):

linrongbin16 opened issue #8128:

hi,

how does wasm threading/eventloop works with rust?

because node.js/deno these javascript runtime usually have their own eventloop, which handles the async/await and IO/network.

but when I am trying to embed wasm into rust, I want to use wasm as a scripting language interpreter, for example I am compiling javascript, and I want to interpret it in rust, with the help of wasm.

And the eventloop (or main thread) should be handled by rust, what will happen if I run async/await in javascript?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 14 2024 at 14:24):

alexcrichton commented on issue #8128:

Hello! I fear that there's no easy answer to your question here since there's a lot of variables that could be involved. The closest thing to an easy answer is probably "tokio". Many programs using async in Rust use tokio as their event loop, and you can use Wasmtime on top of that tokio event loop.

As for how an in-guest interpreter would integrate with the Wasmtime event loop, that I fear also does not have a great answer. At this time the recommendation for that looks something along the lines of:

That ends up having an event loop on an event loop which works because blocking in the guest doesn't block the host. There's work to help remove the event loop from the guest, but that's still under development.


That's at least some information, but I'm not sure if tha answers your questions?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 14 2024 at 21:11):

linrongbin16 closed issue #8128:

hi,

how does wasm threading/eventloop works with rust?

because node.js/deno these javascript runtime usually have their own eventloop, which handles the async/await and IO/network.

but when I am trying to embed wasm into rust, I want to use wasm as a scripting language interpreter, for example I am compiling javascript, and I want to interpret it in rust, with the help of wasm.

And the eventloop (or main thread) should be handled by rust, what will happen if I run async/await in javascript?

view this post on Zulip Wasmtime GitHub notifications bot (Mar 14 2024 at 21:11):

linrongbin16 commented on issue #8128:

that's exactly what I am looking for!

With I study for more time and have a better knowledge, I will keep solving new issues if I have.

thanks!


Last updated: Dec 23 2024 at 13:07 UTC