Util.cpp: Do not call setpriority for thread handles on non-Linux systems.

Change-Id: I50cdc429cd606e261c70219e51587a54a269b082
Signed-off-by: Gleb Popov <6yearold@gmail.com>
This commit is contained in:
Gleb Popov 2020-11-08 19:36:41 +04:00 committed by Michael Meeks
parent 3930ea86a3
commit aa97476f07

View file

@ -16,6 +16,8 @@
# include <sys/syscall.h>
# include <sys/vfs.h>
# include <sys/resource.h>
#elif defined __FreeBSD__
# include <sys/resource.h>
#elif defined IOS
#import <Foundation/Foundation.h>
#endif
@ -523,10 +525,12 @@ namespace Util
int res = setpriority(PRIO_PROCESS, pid, prio);
LOG_TRC("Lowered kit [" << (int)pid << "] priority: " << prio << " with result: " << res);
#ifdef __linux
// rely on Linux thread-id priority setting to drop this thread' priority
pid_t tid = getThreadId();
res = setpriority(PRIO_PROCESS, tid, prio);
LOG_TRC("Lowered own thread [" << (int)tid << "] priority: " << prio << " with result: " << res);
#endif
}
#endif