|
|
@@ -610,16 +610,16 @@ notify_debug_instance_exit(WASMExecEnv *exec_env)
|
|
|
}
|
|
|
|
|
|
void
|
|
|
-wasm_cluster_thread_stopped(WASMExecEnv *exec_env)
|
|
|
+wasm_cluster_thread_waiting_run(WASMExecEnv *exec_env)
|
|
|
{
|
|
|
+ os_mutex_lock(&exec_env->wait_lock);
|
|
|
+
|
|
|
+ /* Wake up debugger thread after we get the lock, otherwise we may miss the
|
|
|
+ * signal from debugger thread, see
|
|
|
+ * https://github.com/bytecodealliance/wasm-micro-runtime/issues/1860 */
|
|
|
exec_env->current_status->running_status = STATUS_STOP;
|
|
|
notify_debug_instance(exec_env);
|
|
|
-}
|
|
|
|
|
|
-void
|
|
|
-wasm_cluster_thread_waiting_run(WASMExecEnv *exec_env)
|
|
|
-{
|
|
|
- os_mutex_lock(&exec_env->wait_lock);
|
|
|
while (!wasm_cluster_thread_is_running(exec_env)) {
|
|
|
os_cond_wait(&exec_env->wait_cond, &exec_env->wait_lock);
|
|
|
}
|
|
|
@@ -646,16 +646,20 @@ wasm_cluster_thread_exited(WASMExecEnv *exec_env)
|
|
|
void
|
|
|
wasm_cluster_thread_continue(WASMExecEnv *exec_env)
|
|
|
{
|
|
|
+ os_mutex_lock(&exec_env->wait_lock);
|
|
|
wasm_cluster_clear_thread_signal(exec_env);
|
|
|
exec_env->current_status->running_status = STATUS_RUNNING;
|
|
|
os_cond_signal(&exec_env->wait_cond);
|
|
|
+ os_mutex_unlock(&exec_env->wait_lock);
|
|
|
}
|
|
|
|
|
|
void
|
|
|
wasm_cluster_thread_step(WASMExecEnv *exec_env)
|
|
|
{
|
|
|
+ os_mutex_lock(&exec_env->wait_lock);
|
|
|
exec_env->current_status->running_status = STATUS_STEP;
|
|
|
os_cond_signal(&exec_env->wait_cond);
|
|
|
+ os_mutex_unlock(&exec_env->wait_lock);
|
|
|
}
|
|
|
|
|
|
void
|