summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/binder/ProcessState.h2
-rw-r--r--libs/binder/ProcessState.cpp9
2 files changed, 11 insertions, 0 deletions
diff --git a/include/binder/ProcessState.h b/include/binder/ProcessState.h
index 9725822eaf..8caf1afedf 100644
--- a/include/binder/ProcessState.h
+++ b/include/binder/ProcessState.h
@@ -70,6 +70,8 @@ public:
void spawnPooledThread(bool isMain);
+ status_t setThreadPoolMaxThreadCount(size_t maxThreads);
+
private:
friend class IPCThreadState;
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 5399e5288c..d95fd6fa93 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -295,6 +295,15 @@ void ProcessState::spawnPooledThread(bool isMain)
}
}
+status_t ProcessState::setThreadPoolMaxThreadCount(size_t maxThreads) {
+ status_t result = NO_ERROR;
+ if (ioctl(mDriverFD, BINDER_SET_MAX_THREADS, &maxThreads) == -1) {
+ result = -errno;
+ ALOGE("Binder ioctl to set max threads failed: %s", strerror(-result));
+ }
+ return result;
+}
+
static int open_driver()
{
int fd = open("/dev/binder", O_RDWR);