summaryrefslogtreecommitdiff
path: root/platform/default/thread.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-08-06 12:41:51 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-08-10 12:01:26 +0300
commit76c937f119bdc673fef2675a4db22731cde85dfe (patch)
treebdd8b0412d4d6b79404ae8e34d8c0d7dbc2fce52 /platform/default/thread.cpp
parentc8a399aa2f96d9f460b5b36bcd8767a2c5ea7a5f (diff)
downloadqtlocation-mapboxgl-76c937f119bdc673fef2675a4db22731cde85dfe.tar.gz
set thread priority on Linux
Diffstat (limited to 'platform/default/thread.cpp')
-rw-r--r--platform/default/thread.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/platform/default/thread.cpp b/platform/default/thread.cpp
index c0a1069b9c..12d1802c2f 100644
--- a/platform/default/thread.cpp
+++ b/platform/default/thread.cpp
@@ -1,11 +1,23 @@
#include <mbgl/platform/platform.hpp>
+#include <mbgl/platform/log.hpp>
+
+#include <pthread.h>
+#include <sched.h>
+
namespace mbgl {
namespace platform {
void makeThreadLowPriority() {
- // no-op
+#ifdef SCHED_IDLE
+ struct sched_param param;
+ param.sched_priority = 0;
+ int status = sched_setscheduler(0, SCHED_IDLE, &param);
+ if (status != 0) {
+ Log::Warning(Event::General, "Couldn't set thread scheduling policy");
+ }
+#endif
}
-}
-}
+} // namespace platform
+} // namespace mbgl