Skip to content

Commit 66eeb4e

Browse files
committed
fix(wasi-threads): return exit code set by proc_exit
1 parent e516de8 commit 66eeb4e

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

core/iwasm/interpreter/wasm_interp_classic.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3419,6 +3419,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
34193419
ret = wasm_runtime_atomic_wait(
34203420
(WASMModuleInstanceCommon *)module, maddr,
34213421
(uint64)expect, timeout, false);
3422+
3423+
#if WASM_ENABLE_THREAD_MGR != 0
3424+
CHECK_SUSPEND_FLAGS();
3425+
#endif
34223426
if (ret == (uint32)-1)
34233427
goto got_exception;
34243428

@@ -3439,6 +3443,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
34393443
ret = wasm_runtime_atomic_wait(
34403444
(WASMModuleInstanceCommon *)module, maddr, expect,
34413445
timeout, true);
3446+
3447+
#if WASM_ENABLE_THREAD_MGR != 0
3448+
CHECK_SUSPEND_FLAGS();
3449+
#endif
34423450
if (ret == (uint32)-1)
34433451
goto got_exception;
34443452

@@ -3894,10 +3902,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
38943902
PUSH_CSP(LABEL_TYPE_FUNCTION, 0, cell_num, frame_ip_end - 1);
38953903

38963904
wasm_exec_env_set_cur_frame(exec_env, frame);
3905+
}
38973906
#if WASM_ENABLE_THREAD_MGR != 0
3898-
CHECK_SUSPEND_FLAGS();
3907+
CHECK_SUSPEND_FLAGS();
38993908
#endif
3900-
}
39013909
HANDLE_OP_END();
39023910
}
39033911

core/iwasm/interpreter/wasm_interp_fast.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3263,6 +3263,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
32633263
ret = wasm_runtime_atomic_wait(
32643264
(WASMModuleInstanceCommon *)module, maddr,
32653265
(uint64)expect, timeout, false);
3266+
3267+
#if WASM_ENABLE_THREAD_MGR != 0
3268+
CHECK_SUSPEND_FLAGS();
3269+
#endif
32663270
if (ret == (uint32)-1)
32673271
goto got_exception;
32683272

@@ -3283,6 +3287,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
32833287
ret = wasm_runtime_atomic_wait(
32843288
(WASMModuleInstanceCommon *)module, maddr, expect,
32853289
timeout, true);
3290+
3291+
#if WASM_ENABLE_THREAD_MGR != 0
3292+
CHECK_SUSPEND_FLAGS();
3293+
#endif
32863294
if (ret == (uint32)-1)
32873295
goto got_exception;
32883296

@@ -3826,6 +3834,9 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
38263834

38273835
wasm_exec_env_set_cur_frame(exec_env, (WASMRuntimeFrame *)frame);
38283836
}
3837+
#if WASM_ENABLE_THREAD_MGR != 0
3838+
CHECK_SUSPEND_FLAGS();
3839+
#endif
38293840
HANDLE_OP_END();
38303841
}
38313842

core/iwasm/libraries/thread-mgr/thread_manager.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ wasm_cluster_create(WASMExecEnv *exec_env)
225225
/* Prepare the aux stack top and size for every thread */
226226
if (!wasm_exec_env_get_aux_stack(exec_env, &aux_stack_start,
227227
&aux_stack_size)) {
228+
#if WASM_ENABLE_LIB_WASI_THREADS == 0
228229
LOG_VERBOSE("No aux stack info for this module, can't create thread");
230+
#endif
229231

230232
/* If the module don't have aux stack info, don't throw error here,
231233
but remain stack_tops and stack_segment_occupied as NULL */

0 commit comments

Comments
 (0)