diff options
author | 2013-03-07 15:34:28 -0800 | |
---|---|---|
committer | 2013-03-07 15:34:28 -0800 | |
commit | e3e43b384e0603e5883b501cdb169641fab8fea2 (patch) | |
tree | 150f4954e60200f4918ba7c065f0b28df0c4093f /libs/binder/ProcessState.cpp | |
parent | 649b976a00c1295e4c1bd2f8c317376f31e9858a (diff) |
rename binder services main thread to Binder_*
When a binder service's main thread joins the thread pool
it retains its name (whatever the exec name was), which is
very confusing in systrace.
we now rename that thread just like its friends in the
thread pool.
Change-Id: Ibb3b6ff07304b247cfc6fb1694e72350c579513e
Diffstat (limited to 'libs/binder/ProcessState.cpp')
-rw-r--r-- | libs/binder/ProcessState.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index d95fd6fa93..294e1d4898 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -283,15 +283,20 @@ void ProcessState::setArgV0(const char* txt) } } +String8 ProcessState::makeBinderThreadName() { + int32_t s = android_atomic_add(1, &mThreadPoolSeq); + String8 name; + name.appendFormat("Binder_%X", s); + return name; +} + void ProcessState::spawnPooledThread(bool isMain) { if (mThreadPoolStarted) { - int32_t s = android_atomic_add(1, &mThreadPoolSeq); - char buf[16]; - snprintf(buf, sizeof(buf), "Binder_%X", s); - ALOGV("Spawning new pooled thread, name=%s\n", buf); + String8 name = makeBinderThreadName(); + ALOGV("Spawning new pooled thread, name=%s\n", name.string()); sp<Thread> t = new PoolThread(isMain); - t->run(buf); + t->run(name.string()); } } @@ -304,6 +309,10 @@ status_t ProcessState::setThreadPoolMaxThreadCount(size_t maxThreads) { return result; } +void ProcessState::giveThreadPoolName() { + androidSetThreadName( makeBinderThreadName().string() ); +} + static int open_driver() { int fd = open("/dev/binder", O_RDWR); |