Enable shared memory && add pthread support (#282)

This commit is contained in:
Xu Jun
2020-06-15 19:04:04 +08:00
committed by GitHub
parent f4d4d69736
commit d98ab63e5c
41 changed files with 3081 additions and 289 deletions

View File

@ -44,6 +44,9 @@ print_help()
#if WASM_ENABLE_MULTI_MODULE != 0
printf(" --module-path= Indicate a module search path. default is current\n"
" directory('./')\n");
#endif
#if WASM_ENABLE_LIB_PTHREAD != 0
printf(" --max-threads=n Set maximum thread number per cluster, default is 4\n");
#endif
return 1;
}
@ -125,6 +128,10 @@ app_instance_repl(wasm_module_inst_t module_inst)
else
cmd[n - 1] = '\0';
}
if (!strcmp(cmd, "__exit__")) {
printf("exit repl mode\n");
break;
}
app_argv = split_string(cmd, &app_argc);
if (app_argv == NULL) {
LOG_ERROR("Wasm prepare param failed: split string failed.\n");
@ -300,6 +307,13 @@ main(int argc, char *argv[])
return print_help();
}
}
#endif
#if WASM_ENABLE_LIB_PTHREAD != 0
else if (!strncmp(argv[0], "--max-threads=", 14)) {
if (argv[0][14] == '\0')
return print_help();
wasm_runtime_set_max_thread_num(atoi(argv[0] + 14));
}
#endif
else
return print_help();