Loading libs/hwui/thread/CommonPool.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -52,9 +52,13 @@ CommonPool::CommonPool() : CommonPoolBase() { } } CommonPool::~CommonPool() { LOG_ALWAYS_FATAL("CommonPool can't be stopped"); } CommonPool& CommonPool::instance() { static CommonPool pool; return pool; static CommonPool* pool = new CommonPool(); return *pool; } void CommonPool::post(Task&& task) { Loading @@ -80,7 +84,7 @@ void CommonPool::enqueue(Task&& task) { void CommonPool::workerLoop() { std::unique_lock lock(mLock); while (!mIsStopping) { while (true) { if (!mWorkQueue.hasWork()) { mWaitingThreads++; mCondition.wait(lock); Loading libs/hwui/thread/CommonPool.h +1 −5 Original line number Diff line number Diff line Loading @@ -108,10 +108,7 @@ private: static CommonPool& instance(); CommonPool(); ~CommonPool() { mIsStopping = true; mCondition.notify_all(); } ~CommonPool(); void enqueue(Task&&); void doWaitForIdle(); Loading @@ -124,7 +121,6 @@ private: std::condition_variable mCondition; int mWaitingThreads = 0; ArrayQueue<Task, QUEUE_SIZE> mWorkQueue; std::atomic_bool mIsStopping = false; }; } // namespace uirenderer Loading Loading
libs/hwui/thread/CommonPool.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -52,9 +52,13 @@ CommonPool::CommonPool() : CommonPoolBase() { } } CommonPool::~CommonPool() { LOG_ALWAYS_FATAL("CommonPool can't be stopped"); } CommonPool& CommonPool::instance() { static CommonPool pool; return pool; static CommonPool* pool = new CommonPool(); return *pool; } void CommonPool::post(Task&& task) { Loading @@ -80,7 +84,7 @@ void CommonPool::enqueue(Task&& task) { void CommonPool::workerLoop() { std::unique_lock lock(mLock); while (!mIsStopping) { while (true) { if (!mWorkQueue.hasWork()) { mWaitingThreads++; mCondition.wait(lock); Loading
libs/hwui/thread/CommonPool.h +1 −5 Original line number Diff line number Diff line Loading @@ -108,10 +108,7 @@ private: static CommonPool& instance(); CommonPool(); ~CommonPool() { mIsStopping = true; mCondition.notify_all(); } ~CommonPool(); void enqueue(Task&&); void doWaitForIdle(); Loading @@ -124,7 +121,6 @@ private: std::condition_variable mCondition; int mWaitingThreads = 0; ArrayQueue<Task, QUEUE_SIZE> mWorkQueue; std::atomic_bool mIsStopping = false; }; } // namespace uirenderer Loading