From bfbe51e1b379a233963d0101145b4728181ed77b Mon Sep 17 00:00:00 2001 From: Enrico Loparco Date: Thu, 23 Mar 2023 07:10:47 +0100 Subject: [PATCH] fix debugger: Set termination flags also when in debug mode (#2048) When using multiple threads, termination flags are checked to stop the thread if a `proc_exit` or trap occurs. They have to be set also in debug mode. Tested using [WASI thread tests](https://github.com/bytecodealliance/wasm-micro-runtime/tree/main/core/iwasm/libraries/lib-wasi-threads/test). --- core/iwasm/libraries/thread-mgr/thread_manager.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/iwasm/libraries/thread-mgr/thread_manager.c b/core/iwasm/libraries/thread-mgr/thread_manager.c index 5e2acdbcd..2bcdba3bd 100644 --- a/core/iwasm/libraries/thread-mgr/thread_manager.c +++ b/core/iwasm/libraries/thread-mgr/thread_manager.c @@ -988,12 +988,12 @@ static void set_thread_cancel_flags(WASMExecEnv *exec_env) { os_mutex_lock(&exec_env->wait_lock); - /* Set the termination flag */ + #if WASM_ENABLE_DEBUG_INTERP != 0 wasm_cluster_thread_send_signal(exec_env, WAMR_SIG_TERM); -#else - exec_env->suspend_flags.flags |= 0x01; #endif + exec_env->suspend_flags.flags |= 0x01; + os_mutex_unlock(&exec_env->wait_lock); }