diff options
| author | 2013-03-08 20:31:57 +0000 | |
|---|---|---|
| committer | 2013-03-08 20:31:57 +0000 | |
| commit | 336dda6b9303d7dcf7ee3ddda3cd8cb3b8305788 (patch) | |
| tree | 42e1b0450f91ade79d4a6e894af7ab83b3541486 /libs/utils/Threads.cpp | |
| parent | 96a63c68433b04937a259dd568ded3e6d9a346d5 (diff) | |
| parent | 3f27f9503356f8f60246dd188c4dd899e8999150 (diff) | |
am 3f27f950: am 6b2b7009: Merge changes Ibb3b6ff0,I2341e20c into jb-mr2-dev
* commit '3f27f9503356f8f60246dd188c4dd899e8999150':
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.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp index f201fc7447..cbf4ef628c 100644 --- a/libs/utils/Threads.cpp +++ b/libs/utils/Threads.cpp @@ -90,30 +90,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, |