Spread module custom data to all threads, enable libc-builtin float print (#633)

This commit is contained in:
Xu Jun
2021-05-19 14:57:31 +08:00
committed by GitHub
parent a14a4487bb
commit f637438e4e
12 changed files with 88 additions and 11 deletions

View File

@ -535,13 +535,13 @@ pthread_create_wrapper(wasm_exec_env_t exec_env,
void *arg) /* arguments buffer */
{
wasm_module_t module = get_module(exec_env);
wasm_module_inst_t module_inst = get_module_inst(exec_env);
wasm_module_inst_t new_module_inst = NULL;
ThreadInfoNode *info_node = NULL;
ThreadRoutineArgs *routine_args = NULL;
uint32 thread_handle;
int32 ret = -1;
#if WASM_ENABLE_LIBC_WASI != 0
wasm_module_inst_t module_inst = get_module_inst(exec_env);
WASIContext *wasi_ctx = get_wasi_ctx(module_inst);
#endif
@ -552,6 +552,13 @@ pthread_create_wrapper(wasm_exec_env_t exec_env,
NULL, 0)))
return -1;
if (module_inst) {
/* Set custom_data to new module instance */
wasm_runtime_set_custom_data_internal(
new_module_inst,
wasm_runtime_get_custom_data(module_inst));
}
#if WASM_ENABLE_LIBC_WASI != 0
if (wasi_ctx)
wasm_runtime_set_wasi_ctx(new_module_inst, wasi_ctx);