wasi-threads
wasi-threads copied to clipboard
Quesitons about `wasi_thread_spawn` semantics
the description of wasi_thread_spawn
says:
instantiate the module again — this child instance will be used for the new thread
it isn't obvious to me which module "the module" here is when multiple modules are involved.
for example, if module A calls a function imported from module B and the function calls wasi_thread_spawn
, which module is it?
also, does instantiate the module again
imply that an engine needs to keep an equivalent of wasm-c-api wasm_extern_vec_t
or "import object" (i mean importObject
argument of WebAssembly.instantiate
) for possible wasi_thread_spawn
operations?
the description of
wasi_thread_spawn
says:instantiate the module again — this child instance will be used for the new thread
it isn't obvious to me which module "the module" here is when multiple modules are involved. for example, if module A calls a function imported from module B and the function calls
wasi_thread_spawn
, which module is it?also, does
instantiate the module again
imply that an engine needs to keep an equivalent of wasm-c-apiwasm_extern_vec_t
or "import object" (i meanimportObject
argument ofWebAssembly.instantiate
) for possiblewasi_thread_spawn
operations?
as i couldn't find a way to determine them reliably, i made them explicitly specified by an embedder for my runtime. https://github.com/yamt/toywasm/blob/ad3c57eaad7f04541c4b4b6f501dcdfe5221919c/lib/wasi_threads.h#L7-L9
if module A calls a function imported from module B and the function calls
wasi_thread_spawn
, which module is it?
I don't think the "multiple linked modules" story is completely figured out. I think this question is similar to the dilemma that wasi-threads faces when attempting to use it in the component model paradigm.
also, does
instantiate the module again
imply that an engine needs to keep an equivalent of wasm-c-apiwasm_extern_vec_t
or "import object"
I believe that is correct; e.g., in Wasmtime the linking happens again for each new thread instantiation.
@yamt, can we close this now?
questions are answered. it seems there is no plan to decide behavior with multiple modules in near future. closing.
reopening because it's a real problem, not just a question.