Remove unnecessary getpriority() system call

This was introduced for a valid reason in aosp/1224543, but that reason
was later removed. This code wasn't.

It is not worth making a system call in order to possibly avoid a second
one, which I expect is no more expensive in that, particularly easy,
case.

Test: Treehugger
Change-Id: I346f9b641c6feb791247b16fb900a4ad97e646d2
This commit is contained in:
Hans Boehm 2024-09-26 12:59:37 -07:00
parent 65daca3b88
commit 1ec5290872

View file

@ -313,11 +313,6 @@ void androidSetCreateThreadFunc(android_create_thread_fn func)
int androidSetThreadPriority(pid_t tid, int pri)
{
int rc = 0;
int curr_pri = getpriority(PRIO_PROCESS, tid);
if (curr_pri == pri) {
return rc;
}
if (setpriority(PRIO_PROCESS, tid, pri) < 0) {
rc = INVALID_OPERATION;