summaryrefslogtreecommitdiff
path: root/platform/default/thread.cpp
blob: 12d1802c2f30ba0dbbd7837276ca99cf8f8f1852 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <mbgl/platform/platform.hpp>

#include <mbgl/platform/log.hpp>

#include <pthread.h>
#include <sched.h>

namespace mbgl {
namespace platform {

void makeThreadLowPriority() {
#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