Skip to content
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

Modules with different native symbols #3830

Open
tvili999 opened this issue Sep 30, 2024 · 1 comment
Open

Modules with different native symbols #3830

tvili999 opened this issue Sep 30, 2024 · 1 comment

Comments

@tvili999
Copy link

tvili999 commented Sep 30, 2024

Thank you for your awesome work!

I'd like to ask some directions in an issue I cannot solve. I have a runtime that runs many modules at the same time in different threads. I initialize the runtime with wasm_runtime_init and register some native modules with wasm_runtime_register_natives.

Then in the threads, I run wasm_runtime_init_thread_env, and load/execute modules separately.

But now we need to run them with two sets of native symbols, so ModuleA needs nativeSymbolsA, and ModuleB needs nativeSymbolsB as native symbols. They both need to run at the same time from the same process, but from different threads. How could I achieve this?

Thank you!

@TianlongLiang
Copy link
Contributor

TianlongLiang commented Oct 8, 2024

IIUC, you want to separate those two sets of native symbols right? You can consider wasm_runtime_init, then in one thread's critical section register_natives the first set of symbols, load the first module(unregister the first set of symbols if there are name conflicting or you don't want module B potentially use the first set of native symbols), and in another thread's critical section, register_natives the second set of symbols and load the second module. By critical section I mean you need to use lock or other sync primitives you prefer to make sure the register-load-unregister process happens atomically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants