summaryrefslogtreecommitdiff
path: root/platform/default/src/mbgl/util/thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/default/src/mbgl/util/thread.cpp')
-rw-r--r--platform/default/src/mbgl/util/thread.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/platform/default/src/mbgl/util/thread.cpp b/platform/default/src/mbgl/util/thread.cpp
index 58a7c12bc8..1ee5b12119 100644
--- a/platform/default/src/mbgl/util/thread.cpp
+++ b/platform/default/src/mbgl/util/thread.cpp
@@ -6,6 +6,7 @@
#include <pthread.h>
#include <sched.h>
+#include <sys/resource.h>
namespace mbgl {
namespace platform {
@@ -40,11 +41,23 @@ void makeThreadLowPriority() {
#endif
}
-void attachThread() {
-}
+void setCurrentThreadPriority(double priority) {
+ if (setpriority(PRIO_PROCESS, 0, int(priority)) < 0) {
+ Log::Warning(Event::General, "Couldn't set thread priority");
+ }
-void detachThread() {
+#ifdef SCHED_OTHER
+ struct sched_param param;
+ param.sched_priority = 0;
+ if (sched_setscheduler(0, SCHED_OTHER, &param) != 0) {
+ Log::Warning(Event::General, "Couldn't set thread scheduling policy");
+ }
+#endif
}
+void attachThread() {}
+
+void detachThread() {}
+
} // namespace platform
} // namespace mbgl