diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-08-06 12:41:51 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-08-10 12:01:26 +0300 |
commit | 76c937f119bdc673fef2675a4db22731cde85dfe (patch) | |
tree | bdd8b0412d4d6b79404ae8e34d8c0d7dbc2fce52 /platform | |
parent | c8a399aa2f96d9f460b5b36bcd8767a2c5ea7a5f (diff) | |
download | qtlocation-mapboxgl-76c937f119bdc673fef2675a4db22731cde85dfe.tar.gz |
set thread priority on Linux
Diffstat (limited to 'platform')
-rw-r--r-- | platform/default/thread.cpp | 18 |
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, ¶m); + if (status != 0) { + Log::Warning(Event::General, "Couldn't set thread scheduling policy"); + } +#endif } -} -} +} // namespace platform +} // namespace mbgl |