Skip to content

Thread use question in Windows #919

@xingkaiyu

Description

@xingkaiyu

I had seen the issue #547
And I tried to use wasm_runtime_init_thread_env() and wasm_runtime_destroy_thread_env().
My code is like this:
1- call wasm_runtime_init_thread_env()
2- call wasm_runtime_call_wasm() and in wasm app create thread.
3- call wasm_runtime_destroy_thread_env() after wasm_runtime_call_wasm()
It works the first time. And wasm_runtime_init_thread_env returns true.
But the follows all went to crash. And wasm_runtime_init_thread_env return false. (I use the same thread as first time)

Then I just call wasm_runtime_init_thread_env one time in this thread. And I do not call wasm_runtime_destroy_thread_env any more.
Then it works well.

So I have some questions:

  1. Is there any bug in wasm_runtime_destroy_thread_env?
  2. Can I only call wasm_runtime_init_thread_env one time and never call wasm_runtime_destroy_thread_env in one thread?
  3. Can wasm_runtime_init_thread_env be used in other platform such as Android?
  4. Which thread don't need to call wasm_runtime_init_thread_env, the thread called wasm_runtime_init, the thread called wasm_runtime_create_exec_env or other?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions