summaryrefslogtreecommitdiff
path: root/libs/utils/Threads.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2013-03-08 20:28:42 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2013-03-08 20:28:43 +0000
commit6b2b7009560964ed25cde06602872dff763b09f4 (patch)
treef5640086e44c8e0b67114cd7f4d7df9255ebb4e7 /libs/utils/Threads.cpp
parent49385ec7c361347a69245c8a0838f6d03343a1de (diff)
parente3e43b384e0603e5883b501cdb169641fab8fea2 (diff)
Merge changes Ibb3b6ff0,I2341e20c into jb-mr2-dev
* changes: rename binder services main thread to Binder_* limit number of extra binder threads in SF to 4
Diffstat (limited to 'libs/utils/Threads.cpp')
-rw-r--r--libs/utils/Threads.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp
index a25a81fbeb..eb964978e4 100644
--- a/libs/utils/Threads.cpp
+++ b/libs/utils/Threads.cpp
@@ -109,30 +109,34 @@ struct thread_data_t {
}
if (name) {
-#if defined(HAVE_PRCTL)
- // Mac OS doesn't have this, and we build libutil for the host too
- int hasAt = 0;
- int hasDot = 0;
- char *s = name;
- while (*s) {
- if (*s == '.') hasDot = 1;
- else if (*s == '@') hasAt = 1;
- s++;
- }
- int len = s - name;
- if (len < 15 || hasAt || !hasDot) {
- s = name;
- } else {
- s = name + len - 15;
- }
- prctl(PR_SET_NAME, (unsigned long) s, 0, 0, 0);
-#endif
+ androidSetThreadName(name);
free(name);
}
return f(u);
}
};
+void androidSetThreadName(const char* name) {
+#if defined(HAVE_PRCTL)
+ // Mac OS doesn't have this, and we build libutil for the host too
+ int hasAt = 0;
+ int hasDot = 0;
+ const char *s = name;
+ while (*s) {
+ if (*s == '.') hasDot = 1;
+ else if (*s == '@') hasAt = 1;
+ s++;
+ }
+ int len = s - name;
+ if (len < 15 || hasAt || !hasDot) {
+ s = name;
+ } else {
+ s = name + len - 15;
+ }
+ prctl(PR_SET_NAME, (unsigned long) s, 0, 0, 0);
+#endif
+}
+
int androidCreateRawThreadEtc(android_thread_func_t entryFunction,
void *userData,
const char* threadName,