Fix execute_main not wait for other threads (#1137)

Fix wasm_application_execute_main/wasm_application_execute_func not waiting for
other threads to terminate in multi-thread mode, which causes that the exception
thrown by other threads may haven't been spreaded to current main thread, and
cannot be detected by the caller, as reported in #1131.
This commit is contained in:
Wenyong Huang
2022-04-29 15:47:43 +08:00
committed by GitHub
parent 2e27d506d8
commit c6997aa68a
4 changed files with 92 additions and 10 deletions

View File

@ -106,6 +106,13 @@ void
wasm_cluster_terminate_all_except_self(WASMCluster *cluster,
WASMExecEnv *exec_env);
void
wams_cluster_wait_for_all(WASMCluster *cluster);
void
wasm_cluster_wait_for_all_except_self(WASMCluster *cluster,
WASMExecEnv *exec_env);
bool
wasm_cluster_add_exec_env(WASMCluster *cluster, WASMExecEnv *exec_env);
@ -148,8 +155,6 @@ typedef struct WASMCurrentEnvStatus {
uint64 signal_flag : 32;
uint64 step_count : 16;
uint64 running_status : 16;
korp_mutex wait_lock;
korp_cond wait_cond;
} WASMCurrentEnvStatus;
WASMCurrentEnvStatus *