From 93788b68c6b16504ef3caa905489472002702900 Mon Sep 17 00:00:00 2001 From: Tony Herre Date: Fri, 28 Jun 2024 09:51:28 +0100 Subject: [PATCH] Make platform_thread.cc build under emscripten without pthread support Otherwise targets which don't need threads but transitively include this fail to build due to missing thread priority symbols as described in the bug. Bug: webrtc:349961287 Change-Id: I33098a150387b8d20ab9344f49d7c7cb19be2db4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/355901 Auto-Submit: Tony Herre Reviewed-by: Tomas Gunnarsson Commit-Queue: Tomas Gunnarsson Cr-Commit-Position: refs/heads/main@{#42563} --- rtc_base/platform_thread.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rtc_base/platform_thread.cc b/rtc_base/platform_thread.cc index 6d369d747e..6433323fc2 100644 --- a/rtc_base/platform_thread.cc +++ b/rtc_base/platform_thread.cc @@ -41,8 +41,10 @@ bool SetPriority(ThreadPriority priority) { #if defined(WEBRTC_WIN) return SetThreadPriority(GetCurrentThread(), Win32PriorityFromThreadPriority(priority)) != FALSE; -#elif defined(__native_client__) || defined(WEBRTC_FUCHSIA) - // Setting thread priorities is not supported in NaCl or Fuchsia. +#elif defined(__native_client__) || defined(WEBRTC_FUCHSIA) || \ + (defined(__EMSCRIPTEN__) && !defined(__EMSCRIPTEN_PTHREADS__)) + // Setting thread priorities is not supported in NaCl, Fuchsia or Emscripten + // without pthreads. return true; #elif defined(WEBRTC_CHROMIUM_BUILD) && defined(WEBRTC_LINUX) // TODO(tommi): Switch to the same mechanism as Chromium uses for changing