summaryrefslogtreecommitdiffstats
path: root/libs/binder/ProcessState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/binder/ProcessState.cpp')
-rw-r--r--libs/binder/ProcessState.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index d95fd6f..294e1d4 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);