aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2009-12-03 12:45:43 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2009-12-03 12:45:43 -0800
commit859e45716b94fe7cdaa63543804cc08acfa139cf (patch)
tree1ff54868db8c0dc7bce966b30224f113d57e21a2
parent6b80016c42c31056258553949ad3bd31d431fd17 (diff)
parentc1c38dd01c43079ed24b9030bc8a20c649bacc3f (diff)
downloadsystem_core-859e45716b94fe7cdaa63543804cc08acfa139cf.tar.gz
system_core-859e45716b94fe7cdaa63543804cc08acfa139cf.tar.bz2
system_core-859e45716b94fe7cdaa63543804cc08acfa139cf.zip
am c1c38dd0: system: sched_policy: Don\'t return an error when the thread we\'re trying to move exits on us
Merge commit 'c1c38dd01c43079ed24b9030bc8a20c649bacc3f' into eclair-plus-aosp * commit 'c1c38dd01c43079ed24b9030bc8a20c649bacc3f': system: sched_policy: Don't return an error when the thread we're trying to move exits on us
-rw-r--r--libcutils/sched_policy.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c
index 64d9bb71..8134aa13 100644
--- a/libcutils/sched_policy.c
+++ b/libcutils/sched_policy.c
@@ -53,13 +53,22 @@ static int add_tid_to_cgroup(int tid, const char *grp_name)
sprintf(path, "/dev/cpuctl/%s/tasks", grp_name);
if ((fd = open(path, O_WRONLY)) < 0) {
- LOGE("add_tid_to_cgroup failed to open '%s' (%s)\n", path, strerror(errno));
+ LOGE("add_tid_to_cgroup failed to open '%s' (%s)\n", path,
+ strerror(errno));
return -1;
}
sprintf(text, "%d", tid);
if (write(fd, text, strlen(text)) < 0) {
close(fd);
+ /*
+ * If the thread is in the process of exiting,
+ * don't flag an error
+ */
+ if (errno == ESRCH)
+ return 0;
+ LOGW("add_tid_to_cgroup failed to write '%s' (%s)\n", path,
+ strerror(errno));
return -1;
}