Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ad1c029 authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge changes I8c2bb308,I384f309e am: 66aaab47

parents 90d04b64 66aaab47
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -358,6 +358,14 @@ status_t BpBinder::linkToDeath(
    LOG_ALWAYS_FATAL_IF(recipient == nullptr,
                        "linkToDeath(): recipient must be non-NULL");

    if (ProcessState::self()->getThreadPoolMaxTotalThreadCount() == 0) {
        ALOGW("Linking to death on %s but there are no threads (yet?) listening to incoming "
              "transactions. See ProcessState::startThreadPool and "
              "ProcessState::setThreadPoolMaxThreadCount. Generally you should setup the binder "
              "threadpool before other initialization steps.",
              String8(getInterfaceDescriptor()).c_str());
    }

    {
        AutoMutex _l(mLock);

+4 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#include <binder/ProcessState.h>

#include <android-base/result.h>
#include <android-base/scopeguard.h>
#include <android-base/strings.h>
#include <binder/BpBinder.h>
#include <binder/IPCThreadState.h>
@@ -420,6 +421,9 @@ status_t ProcessState::setThreadPoolMaxThreadCount(size_t maxThreads) {
}

size_t ProcessState::getThreadPoolMaxTotalThreadCount() const {
    pthread_mutex_lock(&mThreadCountLock);
    base::ScopeGuard detachGuard = [&]() { pthread_mutex_unlock(&mThreadCountLock); };

    // may actually be one more than this, if join is called
    if (mThreadPoolStarted) {
        return mCurrentThreads < mKernelStartedThreads
+1 −1
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ private:
    void* mVMStart;

    // Protects thread count and wait variables below.
    pthread_mutex_t mThreadCountLock;
    mutable pthread_mutex_t mThreadCountLock;
    // Broadcast whenever mWaitingForThreads > 0
    pthread_cond_t mThreadCountDecrement;
    // Number of binder threads current executing a command.