diff --git a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj
index d1f463b24c58bc..402826241612bb 100644
--- a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj
+++ b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj
@@ -123,7 +123,7 @@
true
true
true
- true
+ true
true
true
true
@@ -273,9 +273,6 @@
-
-
-
@@ -288,6 +285,7 @@
+
diff --git a/src/mono/mono/mini/mini-wasm.c b/src/mono/mono/mini/mini-wasm.c
index 6230c1ede105ff..0ea20e8397292e 100644
--- a/src/mono/mono/mini/mini-wasm.c
+++ b/src/mono/mono/mini/mini-wasm.c
@@ -557,9 +557,6 @@ mono_init_native_crash_info (void)
#endif
-// this points to System.Threading.TimerQueue.TimerHandler C# method
-static void *timer_handler;
-
#ifdef HOST_BROWSER
void
@@ -583,6 +580,9 @@ mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo
return FALSE;
}
+// this points to System.Threading.TimerQueue.TimerHandler C# method
+static void *timer_handler;
+
EMSCRIPTEN_KEEPALIVE void
mono_wasm_execute_timer (void)
{
@@ -595,9 +595,7 @@ mono_wasm_execute_timer (void)
cb ();
}
-
-#endif
-
+#ifdef DISABLE_THREADS
void
mono_wasm_main_thread_schedule_timer (void *timerHandler, int shortestDueTimeMs)
{
@@ -605,23 +603,17 @@ mono_wasm_main_thread_schedule_timer (void *timerHandler, int shortestDueTimeMs)
g_assert (timerHandler);
timer_handler = timerHandler;
-#ifdef HOST_BROWSER
-#ifndef DISABLE_THREADS
- if (!mono_threads_wasm_is_browser_thread ()) {
- mono_threads_wasm_async_run_in_main_thread_vi ((void (*)(gpointer))mono_wasm_schedule_timer, GINT_TO_POINTER(shortestDueTimeMs));
- return;
- }
-#endif
mono_wasm_schedule_timer (shortestDueTimeMs);
-#endif
}
+#endif
+#endif
void
mono_arch_register_icall (void)
{
#ifdef HOST_BROWSER
- mono_add_internal_call_internal ("System.Threading.TimerQueue::MainThreadScheduleTimer", mono_wasm_main_thread_schedule_timer);
#ifdef DISABLE_THREADS
+ mono_add_internal_call_internal ("System.Threading.TimerQueue::MainThreadScheduleTimer", mono_wasm_main_thread_schedule_timer);
mono_add_internal_call_internal ("System.Threading.ThreadPool::MainThreadScheduleBackgroundJob", mono_main_thread_schedule_background_job);
#else
mono_add_internal_call_internal ("System.Runtime.InteropServices.JavaScript.JSSynchronizationContext::TargetThreadScheduleBackgroundJob", mono_target_thread_schedule_background_job);
diff --git a/src/mono/mono/mini/mini-wasm.h b/src/mono/mono/mini/mini-wasm.h
index 796b7a0069bdbb..48e6906c10c51f 100644
--- a/src/mono/mono/mini/mini-wasm.h
+++ b/src/mono/mono/mini/mini-wasm.h
@@ -100,7 +100,9 @@ typedef struct {
// sdks/wasm/driver.c is C and uses this
G_EXTERN_C void mono_wasm_enable_debugging (int log_level);
+#ifdef DISABLE_THREADS
void mono_wasm_main_thread_schedule_timer (void *timerHandler, int shortestDueTimeMs);
+#endif // DISABLE_THREADS
void mono_wasm_print_stack_trace (void);