diff options
author | 2023-02-16 01:48:01 +0000 | |
---|---|---|
committer | 2023-02-16 01:49:27 +0000 | |
commit | 2839c45cf9c29c11c588e5fdc868c00922f2ae6e (patch) | |
tree | bbabb0774df95184b7f98d92fa942d19d57be758 /libs/binder/IServiceManager.cpp | |
parent | b1fe177da30fc3771f3e3ba1188476a7856ce000 (diff) |
libbinder: double cost for incorrect wait config
If the process is configured incorrectly, waitForService
waits for 1s. We'd like to make this an error, but when
this was originally introduced, we didn't have functions to
understand the threadpool. So, we start by making it a
little bit more obvious.
Bug: 269503132
Test: N/A
Change-Id: I891a0b2ec4cdaff9fcfb6955dc6f08f0e4e3cfd1
Diffstat (limited to 'libs/binder/IServiceManager.cpp')
-rw-r--r-- | libs/binder/IServiceManager.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 2408307459..d4ef0b73a1 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -412,13 +412,11 @@ sp<IBinder> ServiceManagerShim::waitForService(const String16& name16) // command, so we hang indefinitely. std::unique_lock<std::mutex> lock(waiter->mMutex); using std::literals::chrono_literals::operator""s; - waiter->mCv.wait_for(lock, 1s, [&] { - return waiter->mBinder != nullptr; - }); + waiter->mCv.wait_for(lock, 2s, [&] { return waiter->mBinder != nullptr; }); if (waiter->mBinder != nullptr) return waiter->mBinder; } - ALOGW("Waited one second for %s (is service started? Number of threads started in the " + ALOGW("Waited two seconds for %s (is service started? Number of threads started in the " "threadpool: %zu. Are binder threads started and available?)", name.c_str(), ProcessState::self()->getThreadPoolMaxTotalThreadCount()); |