Skip to content

Commit c568595

Browse files
committed
toywasm_repl_invoke: wait for other threads in case of non-trap return
Note: for some reasons, the current logic in wasi-libc crt returns without wasi_proc_exit when the exit code is 0. maybe just to save a host call? cf. WebAssembly/wasi-libc#367
1 parent a1dfc3c commit c568595

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cli/repl.c

+6
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,12 @@ toywasm_repl_invoke(struct repl_state *state, const char *modname,
819819
goto fail;
820820
}
821821
print_trap(ctx, trap);
822+
} else {
823+
#if defined(TOYWASM_ENABLE_WASI_THREADS)
824+
if (state->wasi_threads != NULL) {
825+
wasi_threads_instance_join(state->wasi_threads);
826+
}
827+
#endif
822828
}
823829
exec_context_clear(ctx);
824830
if (ret != 0) {

0 commit comments

Comments
 (0)