diff options
author | Martijn Coenen <maco@google.com> | 2017-05-11 09:40:45 -0700 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2017-05-11 17:44:45 +0000 |
commit | 3b53fc5a84c4db40830d1810dee309accce66f09 (patch) | |
tree | e8fe59b1d6197fe6529c0ba0ab5f88c020ea3304 /cmds/screencap/screencap.cpp | |
parent | a22a5d83c2ec9d4b0549e92c1d3af7550896e7ee (diff) |
Only spawn one binder thread for screencap.
To work around race conditions in libbinder when
spawning new threads while being shut down.
Bug: 36066697
Test: screencap still works
Change-Id: I774d3dc2491bb578a12dede90cc7fcded976f13f
Diffstat (limited to 'cmds/screencap/screencap.cpp')
-rw-r--r-- | cmds/screencap/screencap.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp index 000420f29c3b..5fedc9e74087 100644 --- a/cmds/screencap/screencap.cpp +++ b/cmds/screencap/screencap.cpp @@ -84,6 +84,11 @@ static status_t notifyMediaScanner(const char* fileName) { int main(int argc, char** argv) { + // setThreadPoolMaxThreadCount(0) actually tells the kernel it's + // not allowed to spawn any additional threads, but we still spawn + // a binder thread from userspace when we call startThreadPool(). + // See b/36066697 for rationale + ProcessState::self()->setThreadPoolMaxThreadCount(0); ProcessState::self()->startThreadPool(); const char* pname = argv[0]; |