From: Debian Qt/KDE Maintainers Date: Sat, 17 Dec 2022 15:20:18 +0000 (+0000) Subject: make mapboxgl build on non-Linux platforms X-Git-Tag: archive/raspbian/5.15.8+dfsg-3+rpi1~1^2^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a179bdc1bc20ccac093484ef6fbca61577624777;p=qtlocation-opensource-src.git make mapboxgl build on non-Linux platforms Origin: upstream, https://github.com/mapbox/mapbox-gl-native/commit/5f031dfa56f28d60 Last-Update: 2020-01-08 Gbp-Pq: Name mapboxgl_thread_portability.diff --- diff --git a/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp b/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp index c7c79b4..cf11d0f 100644 --- a/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp +++ b/src/3rdparty/mapbox-gl-native/platform/default/thread.cpp @@ -11,26 +11,32 @@ namespace platform { std::string getCurrentThreadName() { char name[32] = "unknown"; +#ifdef __linux__ pthread_getname_np(pthread_self(), name, sizeof(name)); +#endif return name; } void setCurrentThreadName(const std::string& name) { +#ifdef __linux__ if (name.size() > 15) { // Linux hard limit (see manpages). pthread_setname_np(pthread_self(), name.substr(0, 15).c_str()); } else { pthread_setname_np(pthread_self(), name.c_str()); } +#endif } void makeThreadLowPriority() { +#ifdef SCHED_IDLE struct sched_param param; param.sched_priority = 0; if (sched_setscheduler(0, SCHED_IDLE, ¶m) != 0) { Log::Warning(Event::General, "Couldn't set thread scheduling policy"); } +#endif } } // namespace platform