File: mapboxgl_thread_portability.diff

package info (click to toggle)
qtlocation-opensource-src 5.15.17%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 33,332 kB
  • sloc: cpp: 169,981; ansic: 3,910; xml: 2,791; java: 477; javascript: 190; sql: 52; makefile: 38
file content (39 lines) | stat: -rw-r--r-- 1,121 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Description: make mapboxgl build on non-Linux platforms
Origin: upstream, https://github.com/mapbox/mapbox-gl-native/commit/5f031dfa56f28d60
Last-Update: 2020-01-08

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