From 76c937f119bdc673fef2675a4db22731cde85dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Thu, 6 Aug 2015 12:41:51 +0200 Subject: [PATCH] set thread priority on Linux --- platform/default/thread.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/platform/default/thread.cpp b/platform/default/thread.cpp index c0a1069b9..12d1802c2 100644 --- a/platform/default/thread.cpp +++ b/platform/default/thread.cpp @@ -1,11 +1,23 @@ #include +#include + +#include +#include + 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, ¶m); + if (status != 0) { + Log::Warning(Event::General, "Couldn't set thread scheduling policy"); + } +#endif } -} -} +} // namespace platform +} // namespace mbgl