summaryrefslogtreecommitdiffstats
path: root/libcutils/sched_policy.c
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2009-12-03 12:19:12 -0800
committerSan Mehat <san@google.com>2009-12-03 12:19:12 -0800
commitc1c38dd01c43079ed24b9030bc8a20c649bacc3f (patch)
tree133fc81447fcb970f11371e821553532912d1455 /libcutils/sched_policy.c
parentbf95c70f83ebb1a3ea92ca3fa440c7ee21e7f6af (diff)
downloadsystem_core-c1c38dd01c43079ed24b9030bc8a20c649bacc3f.zip
system_core-c1c38dd01c43079ed24b9030bc8a20c649bacc3f.tar.gz
system_core-c1c38dd01c43079ed24b9030bc8a20c649bacc3f.tar.bz2
system: sched_policy: Don't return an error when the thread we're trying to move exits on us
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'libcutils/sched_policy.c')
-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 64d9bb7..8134aa1 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;
}