diff options
| author | 2022-12-07 19:19:36 +0000 | |
|---|---|---|
| committer | 2022-12-07 19:19:36 +0000 | |
| commit | 6eeaf1b1484a8043b0b6e49577319c4bf1266e7c (patch) | |
| tree | 2b6f717fecfce7aab0574b4849668fef70513502 | |
| parent | e84bf3ec54f6f555a8294a40e8e98704b2c8de91 (diff) | |
| parent | 96e7d2167aaeae9c3fbdb0ae68d46b2dc460eaf6 (diff) | |
Merge "libbinder*: Provide warning of library threadpool woes." am: 9c0835a838 am: 5eba053724 am: 96e7d2167a
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2329533
Change-Id: I5981cebaaa85378fe9117948457d27850afdb9b6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | libs/binder/include/binder/IPCThreadState.h | 2 | ||||
| -rw-r--r-- | libs/binder/include/binder/ProcessState.h | 3 | ||||
| -rw-r--r-- | libs/binder/ndk/include_platform/android/binder_process.h | 9 |
3 files changed, 14 insertions, 0 deletions
diff --git a/libs/binder/include/binder/IPCThreadState.h b/libs/binder/include/binder/IPCThreadState.h index 65b77c6736..d261c2143c 100644 --- a/libs/binder/include/binder/IPCThreadState.h +++ b/libs/binder/include/binder/IPCThreadState.h @@ -141,11 +141,13 @@ public: void restoreCallingIdentity(int64_t token); bool hasExplicitIdentity(); + // For main functions - dangerous for libraries to use status_t setupPolling(int* fd); status_t handlePolledCommands(); void flushCommands(); bool flushIfNeeded(); + // For main functions - dangerous for libraries to use void joinThreadPool(bool isMain = true); // Stop the local process. diff --git a/libs/binder/include/binder/ProcessState.h b/libs/binder/include/binder/ProcessState.h index 9679a5f477..87eee3d0f2 100644 --- a/libs/binder/include/binder/ProcessState.h +++ b/libs/binder/include/binder/ProcessState.h @@ -50,6 +50,7 @@ public: sp<IBinder> getContextObject(const sp<IBinder>& caller); + // For main functions - dangerous for libraries to use void startThreadPool(); bool becomeContextManager(); @@ -57,8 +58,10 @@ public: sp<IBinder> getStrongProxyForHandle(int32_t handle); void expungeHandle(int32_t handle, IBinder* binder); + // TODO: deprecate. void spawnPooledThread(bool isMain); + // For main functions - dangerous for libraries to use status_t setThreadPoolMaxThreadCount(size_t maxThreads); status_t enableOnewaySpamDetection(bool enable); void giveThreadPoolName(); diff --git a/libs/binder/ndk/include_platform/android/binder_process.h b/libs/binder/ndk/include_platform/android/binder_process.h index f408fadee0..89231295dd 100644 --- a/libs/binder/ndk/include_platform/android/binder_process.h +++ b/libs/binder/ndk/include_platform/android/binder_process.h @@ -28,17 +28,26 @@ __BEGIN_DECLS * * When using this, it is expected that ABinderProcess_setupPolling and * ABinderProcess_handlePolledCommands are not used. + * + * Do not use this from a library. Apps setup their own threadpools, and otherwise, the main + * function should be responsible for configuring the threadpool for the entire application. */ void ABinderProcess_startThreadPool(); /** * This sets the maximum number of threads that can be started in the threadpool. By default, after * startThreadPool is called, this is 15. If it is called additional times, it will only prevent * the kernel from starting new threads and will not delete already existing threads. + * + * Do not use this from a library. Apps setup their own threadpools, and otherwise, the main + * function should be responsible for configuring the threadpool for the entire application. */ bool ABinderProcess_setThreadPoolMaxThreadCount(uint32_t numThreads); /** * This adds the current thread to the threadpool. This may cause the threadpool to exceed the * maximum size. + * + * Do not use this from a library. Apps setup their own threadpools, and otherwise, the main + * function should be responsible for configuring the threadpool for the entire application. */ void ABinderProcess_joinThreadPool(); |