-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WapcHost
usage in async contexts
#92
Comments
@muse254 that's super nice. This is something I wanted to implement since a long time. I'll take a look at the drafted PR during this week. |
I looked into your draft PR, then I started working on the topic during the weekend. The amount of changes to be done was massive. Everything seems to be working 😀 |
I'll be looking forward to the next release. Thank you for the fast turnaround. |
Allow waPC host to be used inside of an asynchronous runtime New structs and traits have been added: - New struct `WapcHostAsync`, this is the equivalent of `WapcHost` but for async environments. - New trait `WebAssemblyEngineProviderAsync`, this is the equivalent of `WebAssemblyEngineProvider` but for async environments. - New trait `ModuleHostAsync`, this is the equivalent of `ModuleHost` but for async environments. An async runtime has an `async` host callback function. The new type alias `HostCallbackAsync` is used to define this function. The signature of this function is slightly different from the one of the `sync` counterpart. All the input paremeters are owned types, not pointers. That's required because the function can be sent to different threads by the async runtime; introducing lifetime constraints proved to be impossible. The async support is behind a feature flag named `asyc`. This flag is enabled by default. The implementation relies on the tokio crate. Other notable changes: - The `sync` code has been moved to dedicated files to separate it from the `async` code. - The documentation now states which feature flags might be required to use a struct, type, trait, or method. Fixes wapc#92 Signed-off-by: Flavio Castelli <[email protected]>
Allow usage of wasmtime-provider inside of an asynchronous runtime. New structs and traits have been added: - New struct `WasmtimeEngineProviderAsync`, this is the equivalent of `WasmtimeEngineProvider` but for async environments. - New struct `WasmtimeEngineProviderAsyncPre`, this is the equivalent of `WasmtimeEngineProviderPre` but for async environments. - The `WasmtimeEngineProviderBuilder` has been extened to allow the creation of the new "async" objects describe above. The async support is behind a feature flag named `asyc`. This flag is enabled by default. The implementation relies on the tokio crate. Other notable changes: - The `sync` code has been moved to dedicated files to separate it from the `async` code. - The documentation now states which feature flags might be required to use a struct, type, trait, or method. - New and improved tests - Reorganized the examples, new ones have been introduced for the async counterparts - Improved `make test` target to cover all the different combination of feature flags - Fix compilation errors caused by different flag combinations Fixes wapc#92 Signed-off-by: Flavio Castelli <[email protected]>
@muse254 take a look at the linked PR and let me know what do you think about it. I've also added examples |
Hey, it looks really fleshed out. I'll be trying it out to see if I have any issues to report |
@flavio I've done some initial tests, and everything seems to be working well, at least for my use cases with |
Hey, how's the review coming along. Saw that it's stale. |
Allow waPC host to be used inside of an asynchronous runtime New structs and traits have been added: - New struct `WapcHostAsync`, this is the equivalent of `WapcHost` but for async environments. - New trait `WebAssemblyEngineProviderAsync`, this is the equivalent of `WebAssemblyEngineProvider` but for async environments. - New trait `ModuleHostAsync`, this is the equivalent of `ModuleHost` but for async environments. An async runtime has an `async` host callback function. The new type alias `HostCallbackAsync` is used to define this function. The signature of this function is slightly different from the one of the `sync` counterpart. All the input paremeters are owned types, not pointers. That's required because the function can be sent to different threads by the async runtime; introducing lifetime constraints proved to be impossible. The async support is behind a feature flag named `asyc`. This flag is enabled by default. The implementation relies on the tokio crate. Other notable changes: - The `sync` code has been moved to dedicated files to separate it from the `async` code. - The documentation now states which feature flags might be required to use a struct, type, trait, or method. Fixes wapc#92 Signed-off-by: Flavio Castelli <[email protected]>
Allow usage of wasmtime-provider inside of an asynchronous runtime. New structs and traits have been added: - New struct `WasmtimeEngineProviderAsync`, this is the equivalent of `WasmtimeEngineProvider` but for async environments. - New struct `WasmtimeEngineProviderAsyncPre`, this is the equivalent of `WasmtimeEngineProviderPre` but for async environments. - The `WasmtimeEngineProviderBuilder` has been extened to allow the creation of the new "async" objects describe above. The async support is behind a feature flag named `asyc`. This flag is enabled by default. The implementation relies on the tokio crate. Other notable changes: - The `sync` code has been moved to dedicated files to separate it from the `async` code. - The documentation now states which feature flags might be required to use a struct, type, trait, or method. - New and improved tests - Reorganized the examples, new ones have been introduced for the async counterparts - Improved `make test` target to cover all the different combination of feature flags - Fix compilation errors caused by different flag combinations Fixes wapc#92 Signed-off-by: Flavio Castelli <[email protected]>
Allow usage of wasmtime-provider inside of an asynchronous runtime. New structs and traits have been added: - New struct `WasmtimeEngineProviderAsync`, this is the equivalent of `WasmtimeEngineProvider` but for async environments. - New struct `WasmtimeEngineProviderAsyncPre`, this is the equivalent of `WasmtimeEngineProviderPre` but for async environments. - The `WasmtimeEngineProviderBuilder` has been extened to allow the creation of the new "async" objects describe above. The async support is behind a feature flag named `asyc`. This flag is enabled by default. The implementation relies on the tokio crate. Other notable changes: - The `sync` code has been moved to dedicated files to separate it from the `async` code. - The documentation now states which feature flags might be required to use a struct, type, trait, or method. - New and improved tests - Reorganized the examples, new ones have been introduced for the async counterparts - Improved `make test` target to cover all the different combination of feature flags - Fix compilation errors caused by different flag combinations Fixes #92 Signed-off-by: Flavio Castelli <[email protected]>
@muse254: |
Awesome! Can't wait to start the upgrade 🚀 |
I'd like to request for
WapcHost
to have another implementation that can be used in async environments by the caller.I'm aware that execution of WebAssembly modules is single threaded.
No amount of ceremony helped sidestep this issue. Also redoing the implementation in project doesn't work because of private fields/methods accessed.
Here's what I settled for reference: https://github.com/muse254/wapc-rs/pull/1/files
The error related to this: (
self
holdsWapcHost
in it's fields)The text was updated successfully, but these errors were encountered: