Skip to content

Commit

Permalink
Fix for timer scheduling happening on the incorrect thread when wasm …
Browse files Browse the repository at this point in the history
…threading is enabled (#70863)
  • Loading branch information
kg authored Jun 17, 2022
1 parent 6d6a373 commit 5df4473
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/mono/mono/mini/mini-wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
#include <mono/utils/mono-threads.h>
#include <mono/metadata/components.h>

#ifdef HOST_BROWSER
#ifndef DISABLE_THREADS
#include <mono/utils/mono-threads-wasm.h>
#endif
#endif

static int mono_wasm_debug_level = 0;
#ifndef DISABLE_JIT

Expand Down Expand Up @@ -617,7 +623,13 @@ void
mono_wasm_set_timeout (int timeout)
{
#ifdef HOST_BROWSER
mono_set_timeout (timeout);
#ifndef DISABLE_THREADS
if (!mono_threads_wasm_is_browser_thread ()) {
mono_threads_wasm_async_run_in_main_thread_vi ((void (*)(gpointer))mono_wasm_set_timeout, GINT_TO_POINTER(timeout));
return;
}
#endif
mono_set_timeout (timeout);
#endif
}

Expand Down

0 comments on commit 5df4473

Please sign in to comment.