am ef16a545: Merge change I2867746d into eclair

Merge commit 'ef16a545dca8deacdcdd89cb493d556adf7a8be8' into eclair-mr2

* commit 'ef16a545dca8deacdcdd89cb493d556adf7a8be8':
  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:
Jason Parks
2009-11-04 14:59:54 -08:00
committed by Android Git Automerger

View File

@@ -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