diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2020-08-26 02:39:27 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-08-26 02:39:27 +0000 |
commit | 04fcafce631af4d57b51a9fe4d7e539e5ab184d0 (patch) | |
tree | 74340d5963195cc523cdc0e5572908556cc4a16c /libutils/Threads.cpp | |
parent | 6b495650dc568c7db871ef208571029b1680f935 (diff) | |
parent | 2d693048eecd2cbf15c7b20f275470908b9afbd2 (diff) |
Merge "Fix API for C compatibility" am: 6f3e974ab5 am: 909219ccc2 am: aa86d0ae3c am: 2d693048ee
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1408797
Change-Id: I4e1d7458609294e6c5320c6a68a6689aa44e34b1
Diffstat (limited to 'libutils/Threads.cpp')
-rw-r--r-- | libutils/Threads.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libutils/Threads.cpp b/libutils/Threads.cpp index 147db542d..55eadb07a 100644 --- a/libutils/Threads.cpp +++ b/libutils/Threads.cpp @@ -302,7 +302,8 @@ void androidSetCreateThreadFunc(android_create_thread_fn func) } #if defined(__ANDROID__) -int androidSetThreadPriority(pid_t tid, int pri, bool change_policy) { +namespace { +int androidSetThreadPriorityInternal(pid_t tid, int pri, bool change_policy) { int rc = 0; int lasterr = 0; int curr_pri = getpriority(PRIO_PROCESS, tid); @@ -334,6 +335,15 @@ int androidSetThreadPriority(pid_t tid, int pri, bool change_policy) { return rc; } +} // namespace + +int androidSetThreadPriority(pid_t tid, int pri) { + return androidSetThreadPriorityInternal(tid, pri, true); +} + +int androidSetThreadPriorityAndPolicy(pid_t tid, int pri, bool change_policy) { + return androidSetThreadPriorityInternal(tid, pri, change_policy); +} int androidGetThreadPriority(pid_t tid) { return getpriority(PRIO_PROCESS, tid); |