summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSan Mehat2009-12-03 14:19:12 -0600
committerSan Mehat2009-12-03 14:19:12 -0600
commitc1c38dd01c43079ed24b9030bc8a20c649bacc3f (patch)
tree133fc81447fcb970f11371e821553532912d1455
parentbf95c70f83ebb1a3ea92ca3fa440c7ee21e7f6af (diff)
downloadplatform-system-core-android-2.1_r1.tar.gz
platform-system-core-android-2.1_r1.tar.xz
platform-system-core-android-2.1_r1.zip
system: sched_policy: Don't return an error when the thread we're trying to move exits on usandroid-2.1_r1
Signed-off-by: San Mehat <san@google.com>
-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 64d9bb71a..8134aa13a 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)
53 sprintf(path, "/dev/cpuctl/%s/tasks", grp_name); 53 sprintf(path, "/dev/cpuctl/%s/tasks", grp_name);
54 54
55 if ((fd = open(path, O_WRONLY)) < 0) { 55 if ((fd = open(path, O_WRONLY)) < 0) {
56 LOGE("add_tid_to_cgroup failed to open '%s' (%s)\n", path, strerror(errno)); 56 LOGE("add_tid_to_cgroup failed to open '%s' (%s)\n", path,
57 strerror(errno));
57 return -1; 58 return -1;
58 } 59 }
59 60
60 sprintf(text, "%d", tid); 61 sprintf(text, "%d", tid);
61 if (write(fd, text, strlen(text)) < 0) { 62 if (write(fd, text, strlen(text)) < 0) {
62 close(fd); 63 close(fd);
64 /*
65 * If the thread is in the process of exiting,
66 * don't flag an error
67 */
68 if (errno == ESRCH)
69 return 0;
70 LOGW("add_tid_to_cgroup failed to write '%s' (%s)\n", path,
71 strerror(errno));
63 return -1; 72 return -1;
64 } 73 }
65 74