diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-12-29 15:27:58 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-12-29 15:27:58 +0100 |
commit | e4cab3f37fda236339d40a0de291cd75c9b1a51e (patch) | |
tree | a1e06f14fec34c131f5c8e508b7d9b4a95825696 | |
parent | 6d876f1d6bf95827598809b965ed6a6e06008675 (diff) | |
download | qtlocation-mapboxgl-e4cab3f37fda236339d40a0de291cd75c9b1a51e.tar.gz |
[util] fix thread.cpp portabilityupstream/pr-16085
-rw-r--r-- | platform/default/src/mbgl/util/thread.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/default/src/mbgl/util/thread.cpp b/platform/default/src/mbgl/util/thread.cpp index 28772d9561..58a7c12bc8 100644 --- a/platform/default/src/mbgl/util/thread.cpp +++ b/platform/default/src/mbgl/util/thread.cpp @@ -12,26 +12,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 } void attachThread() { |