Can I use wamr in multithreaded environment? #3012
-
Hi! I'm trying to run multiple modules in parallel, using C++ threads. What I'm doing is that:
The only wrong thing is exception with a message: "thread signal env not inited". If I comment this check out, everything is working. So what I'm doing wrong, why this exception is raised - there's no any documentation on that. Also, I've read this issue, it is proposed to use |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, for "thread signal env not inited", maybe you can try calling wasm_runtime_init_thread_env in the beginning of the new thread's callback, and wasm_runtime_destroy_thread_env in the end of the callback. Refer to: |
Beta Was this translation helpful? Give feedback.
Hi, for "thread signal env not inited", maybe you can try calling wasm_runtime_init_thread_env in the beginning of the new thread's callback, and wasm_runtime_destroy_thread_env in the end of the callback. Refer to:
https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/core/iwasm/include/wasm_export.h#L719-L738