From 47214367aab1c11d7d242d9acfea3512e6b7c837 Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Tue, 26 Apr 2022 10:03:07 -0400 Subject: [PATCH 1/3] follow code style --- .../System.Private.CoreLib/src/System/Threading/Thread.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs index 7efa9b6a2a0126..56430968ad03d5 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs @@ -163,7 +163,8 @@ public Thread(ParameterizedThreadStart start, int maxStackSize) #endif #endif - internal static void ThrowIfNoThreadStart() { + internal static void ThrowIfNoThreadStart() + { if (!IsThreadStartSupported) throw new PlatformNotSupportedException(); } From 8931dc7a06204a42d024bd70e1f346a9ea1efffd Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Tue, 26 Apr 2022 12:36:00 -0400 Subject: [PATCH 2/3] [threads] initialize pthreads_getschedparam policy On Emscripten, pthreads_getschedparam doesn't write to its output variables, so set them to good initial values --- src/mono/mono/metadata/threads.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/metadata/threads.c b/src/mono/mono/metadata/threads.c index f40e96030d3088..418ee6100a95ed 100644 --- a/src/mono/mono/metadata/threads.c +++ b/src/mono/mono/metadata/threads.c @@ -684,8 +684,8 @@ mono_thread_internal_set_priority (MonoInternalThread *internal, MonoThreadPrior return; #else /* !HOST_WIN32 and not HOST_FUCHSIA */ pthread_t tid; - int policy; - struct sched_param param; + int policy = SCHED_OTHER; + struct sched_param param = {0,}; gint res; tid = thread_get_tid (internal); From ed2ab374b7a8214a601c5c70466b2dba597f16ce Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Tue, 26 Apr 2022 12:48:26 -0400 Subject: [PATCH 3/3] [wasm-mt] fix logic error in wasm.proj / CMakeLists.txt The wasm CMakeLists.txt defaults DISABLE_THREADS to ON, so instead set it to _off_ when MonoWasmThreads is true, and leave it at the default value (ie off) otherwise. --- src/mono/wasm/wasm.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/wasm/wasm.proj b/src/mono/wasm/wasm.proj index c89caa7139db7d..e439c173cc61fd 100644 --- a/src/mono/wasm/wasm.proj +++ b/src/mono/wasm/wasm.proj @@ -204,7 +204,7 @@ $(CMakeBuildRuntimeConfigureCmd) -DICU_LIB_DIR="$(ICULibDir.TrimEnd('\/'))" $(CMakeBuildRuntimeConfigureCmd) -DMONO_ARTIFACTS_DIR="$(MonoArtifactsPath.TrimEnd('\/'))" $(CMakeBuildRuntimeConfigureCmd) -DNATIVE_BIN_DIR="$(NativeBinDir.TrimEnd('\/'))" - $(CMakeBuildRuntimeConfigureCmd) -DDISABLE_THREADS=1 + $(CMakeBuildRuntimeConfigureCmd) -DDISABLE_THREADS=0 $(CMakeBuildRuntimeConfigureCmd) -DDISABLE_WASM_USER_THREADS=1 $(CMakeBuildRuntimeConfigureCmd) $(CMakeConfigurationEmsdkPath)