[core] Add platform::setCurrentThreadPriority(double)

This commit is contained in:
Alexander Shalamov
2020-01-31 17:01:12 +02:00
parent 5789faf11a
commit 4be2fa4f9a
5 changed files with 40 additions and 3 deletions

View File

@@ -40,6 +40,14 @@ void makeThreadLowPriority() {
setpriority(PRIO_PROCESS, 0, 19);
}
void setCurrentThreadPriority(double priority) {
if (priority < -20 || priority > 19) {
Log::Warning(Event::General, "Couldn't set thread priority");
return;
}
setpriority(PRIO_PROCESS, 0, int(priority));
}
void attachThread() {
using namespace android;
assert(env == nullptr);