make mapboxgl build on non-Linux platforms
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Fri, 11 Dec 2020 08:31:57 +0000 (08:31 +0000)
committerDmitry Shachnev <mitya57@debian.org>
Fri, 11 Dec 2020 08:31:57 +0000 (08:31 +0000)
Origin: upstream, https://github.com/mapbox/mapbox-gl-native/commit/5f031dfa56f28d60
Last-Update: 2020-01-08

Gbp-Pq: Name mapboxgl_thread_portability.diff

src/3rdparty/mapbox-gl-native/platform/default/thread.cpp

index c7c79b4fb097dab3b2d0c0e45aadffe9f2e6b0ab..cf11d0ffc525ea183deb1b37cdcab681bb368a55 100644 (file)
@@ -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, &param) != 0) {
         Log::Warning(Event::General, "Couldn't set thread scheduling policy");
     }
+#endif
 }
 
 } // namespace platform