From 1ec5290872b1bd120e44ebffddd47b2a62bc90d1 Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Thu, 26 Sep 2024 12:59:37 -0700 Subject: [PATCH] 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 --- libutils/Threads.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libutils/Threads.cpp b/libutils/Threads.cpp index d8d75acf4..111d46af9 100644 --- a/libutils/Threads.cpp +++ b/libutils/Threads.cpp @@ -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;