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 <herre@google.com>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42563}
This commit is contained in:
Tony Herre 2024-06-28 09:51:28 +01:00 committed by WebRTC LUCI CQ
parent fb2c7bc8bd
commit 93788b68c6

View File

@ -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