Configure threadpool to size one when polling.
When using the poll() interface, only one thread can
be used; make sure that is the default configuration.
Bug: 62826568
Test: polling servers/clients (eg hwservicemanager) still work
Change-Id: Iea95554a5c2d02aeba79b5983359172f69708103
diff --git a/IPCThreadState.cpp b/IPCThreadState.cpp
index b251051..2f27c2b 100644
--- a/IPCThreadState.cpp
+++ b/IPCThreadState.cpp
@@ -533,6 +533,11 @@
return -EBADF;
}
+ // Tells the kernel to not spawn any additional binder threads,
+ // as that won't work with polling. Also, the caller is responsible
+ // for subsequently calling handlePolledCommands()
+ mProcess->setThreadPoolConfiguration(1, true /* callerWillJoin */);
+
mOut.writeInt32(BC_ENTER_LOOPER);
*fd = mProcess->mDriverFD;
return 0;