Better errors for configureBinderRpcThreadpool.
- crash if it fails (failed communication with binder)
- log if joinRpcThreadpool is called without configureRpcThreadpool
Bug: 80102279
Test: boot a Pixel
Change-Id: I37d2511e9caf7e6a3d4f215f93c552aa503c8ba1
diff --git a/transport/HidlBinderSupport.cpp b/transport/HidlBinderSupport.cpp
index d884544..4a24a3e 100644
--- a/transport/HidlBinderSupport.cpp
+++ b/transport/HidlBinderSupport.cpp
@@ -196,11 +196,21 @@
return status;
}
+static bool gThreadPoolConfigured = false;
+
void configureBinderRpcThreadpool(size_t maxThreads, bool callerWillJoin) {
- ProcessState::self()->setThreadPoolConfiguration(maxThreads, callerWillJoin /*callerJoinsPool*/);
+ status_t ret = ProcessState::self()->setThreadPoolConfiguration(
+ maxThreads, callerWillJoin /*callerJoinsPool*/);
+ LOG_ALWAYS_FATAL_IF(ret != OK, "Could not setThreadPoolConfiguration: %d", ret);
+
+ gThreadPoolConfigured = true;
}
void joinBinderRpcThreadpool() {
+ if (!gThreadPoolConfigured) {
+ ALOGE("HIDL joinRpcThreadpool without calling configureRpcThreadPool.");
+ }
+
IPCThreadState::self()->joinThreadPool();
}