File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -775,6 +775,7 @@ void IPCThreadState::joinThreadPool(bool isMain)
775775{
776776 LOG_THREADPOOL (" **** THREAD %p (PID %d) IS JOINING THE THREAD POOL\n " , (void *)pthread_self (),
777777 getpid ());
778+ mProcess ->checkExpectingThreadPoolStart ();
778779 mProcess ->mCurrentThreads ++;
779780 mOut .writeInt32 (isMain ? BC_ENTER_LOOPER : BC_REGISTER_LOOPER);
780781
Original file line number Diff line number Diff line change @@ -501,6 +501,21 @@ bool ProcessState::isThreadPoolStarted() const {
501501 return mThreadPoolStarted ;
502502}
503503
504+ void ProcessState::checkExpectingThreadPoolStart () const {
505+ if (mThreadPoolStarted ) return ;
506+
507+ // this is also racey, but you should setup the threadpool in the main thread. If that is an
508+ // issue, we can check if we are the process leader, but haven't seen the issue in practice.
509+ size_t requestedThreads = mMaxThreads .load ();
510+
511+ // if it's manually set to the default, we do ignore it here...
512+ if (requestedThreads == DEFAULT_MAX_BINDER_THREADS) return ;
513+ if (requestedThreads == 0 ) return ;
514+
515+ ALOGW (" Thread pool configuration of size %zu requested, but startThreadPool was not called." ,
516+ requestedThreads);
517+ }
518+
504519#define DRIVER_FEATURES_PATH " /dev/binderfs/features/"
505520bool ProcessState::isDriverFeatureEnabled (const DriverFeature feature) {
506521 // Use static variable to cache the results.
Original file line number Diff line number Diff line change @@ -141,6 +141,8 @@ class ProcessState : public virtual RefBase {
141141private:
142142 static sp<ProcessState> init (const char * defaultDriver, bool requireDefault);
143143
144+ void checkExpectingThreadPoolStart () const ;
145+
144146 static void onFork ();
145147 static void parentPostFork ();
146148 static void childPostFork ();
You can’t perform that action at this time.
0 commit comments