Merge commit 'ee9f9759ba84b2a4a69d180e299511a91621f33a' into eclair-mr2-plus-aosp * commit 'ee9f9759ba84b2a4a69d180e299511a91621f33a': Reset binder service threads' cgroup/priority after command completion
This commit is contained in:
@@ -426,6 +426,21 @@ void IPCThreadState::joinThreadPool(bool isMain)
|
|||||||
result = executeCommand(cmd);
|
result = executeCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After executing the command, ensure that the thread is returned to the
|
||||||
|
// default cgroup and priority before rejoining the pool. This is a failsafe
|
||||||
|
// in case the command implementation failed to properly restore the thread's
|
||||||
|
// scheduling parameters upon completion.
|
||||||
|
int my_id;
|
||||||
|
#ifdef HAVE_GETTID
|
||||||
|
my_id = gettid();
|
||||||
|
#else
|
||||||
|
my_id = getpid();
|
||||||
|
#endif
|
||||||
|
if (!set_sched_policy(my_id, SP_FOREGROUND)) {
|
||||||
|
// success; reset the priority as well
|
||||||
|
setpriority(PRIO_PROCESS, my_id, ANDROID_PRIORITY_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
// Let this thread exit the thread pool if it is no longer
|
// Let this thread exit the thread pool if it is no longer
|
||||||
// needed and it is not the main process thread.
|
// needed and it is not the main process thread.
|
||||||
if(result == TIMED_OUT && !isMain) {
|
if(result == TIMED_OUT && !isMain) {
|
||||||
|
|||||||
Reference in New Issue
Block a user