Merge commit '6176790ed5f21ab102d438c252509deda050da0b' into eclair-mr2-plus-aosp * commit '6176790ed5f21ab102d438c252509deda050da0b': When a thread is about to be put back onto the thread pool ensure that it is in the foreground cgroup.
This commit is contained in:
@@ -422,31 +422,13 @@ void IPCThreadState::joinThreadPool(bool isMain)
|
|||||||
<< getReturnString(cmd) << endl;
|
<< getReturnString(cmd) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isTainted = false;
|
|
||||||
|
|
||||||
{
|
|
||||||
SchedPolicy policy;
|
|
||||||
get_sched_policy(getpid(), &policy);
|
|
||||||
|
|
||||||
if (policy == SP_BACKGROUND) {
|
|
||||||
isTainted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result = executeCommand(cmd);
|
result = executeCommand(cmd);
|
||||||
|
|
||||||
// Make sure that after executing the commands that we put the thread back into the
|
// Make sure that after executing the command that we put the thread back into the
|
||||||
// default cgroup.
|
// default cgroup. This is just a failsafe incase the thread's priority or cgroup was
|
||||||
{
|
// not properly restored.
|
||||||
int pid = getpid();
|
set_sched_policy(getpid(), SP_FOREGROUND);
|
||||||
SchedPolicy policy;
|
|
||||||
get_sched_policy(pid, &policy);
|
|
||||||
|
|
||||||
if (!isTainted && policy == SP_BACKGROUND) {
|
|
||||||
LOGW("*** THREAD %p (PID %p) was left in SP_BACKGROUND with a priority of %d\n",
|
|
||||||
(void*)pthread_self(), pid, getpriority(PRIO_PROCESS, pid));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let this thread exit the thread pool if it is no longer
|
// Let this thread exit the thread pool if it is no longer
|
||||||
|
|||||||
Reference in New Issue
Block a user