diff options
| author | Glenn Kasten <gkasten@google.com> | 2011-06-14 10:35:34 -0700 |
|---|---|---|
| committer | Alex Ray <aray@google.com> | 2013-07-30 13:56:57 -0700 |
| commit | 47f48572db6a5b4b1b890f93f07ff2bd7c7dc95c (patch) | |
| tree | dbc4b0df7976155eb4a1f3befdc21b0b3122a5ba /libs/utils | |
| parent | 9b6259aa579291deb7334a968bd30878a5fec386 (diff) | |
| download | system_core-47f48572db6a5b4b1b890f93f07ff2bd7c7dc95c.zip system_core-47f48572db6a5b4b1b890f93f07ff2bd7c7dc95c.tar.gz system_core-47f48572db6a5b4b1b890f93f07ff2bd7c7dc95c.tar.bz2 | |
Bug 4608375
Update priority and policy together for audio threads
Change-Id: Ib3b07b32586c222c4aacbf23414ae8b05db502be
Diffstat (limited to 'libs/utils')
| -rw-r--r-- | libs/utils/Threads.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp index c748228..15bb1d2 100644 --- a/libs/utils/Threads.cpp +++ b/libs/utils/Threads.cpp @@ -335,10 +335,17 @@ int androidSetThreadPriority(pid_t tid, int pri) pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup); if (gDoSchedulingGroup) { + // set_sched_policy does not support tid == 0 + int policy_tid; + if (tid == 0) { + policy_tid = androidGetTid(); + } else { + policy_tid = tid; + } if (pri >= ANDROID_PRIORITY_BACKGROUND) { - rc = set_sched_policy(tid, SP_BACKGROUND); + rc = set_sched_policy(policy_tid, SP_BACKGROUND); } else if (getpriority(PRIO_PROCESS, tid) >= ANDROID_PRIORITY_BACKGROUND) { - rc = set_sched_policy(tid, SP_FOREGROUND); + rc = set_sched_policy(policy_tid, SP_FOREGROUND); } } |
