set thread priority on Linux

This commit is contained in:
Konstantin Käfer
2015-08-06 12:41:51 +02:00
parent c8a399aa2f
commit 76c937f119

View File

@@ -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