diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index c1f49250bc0e26724185366476f3706c117977eb..d44f7ce25f4bfe6c9ab4093b3d8136e34b894b12 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -35,7 +35,7 @@ std::atomic< U32 > sImageThreads = 0; class PoolWorkerThread final : public LLThread { public: - PoolWorkerThread(std::string name) : LLThread(name), mRequestQueue(30) + PoolWorkerThread(std::string name) : LLThread(name), mRequestQueue(1024) { } @@ -64,8 +64,10 @@ class PoolWorkerThread final : public LLThread bool setRequest(LLImageDecodeThread::ImageRequest* req) { bool bSuccess = mRequestQueue.try_enqueue(req); - wake(); - + if(bSuccess) + { + wake(); + } return bSuccess; } @@ -102,7 +104,11 @@ LLImageDecodeThread::LLImageDecodeThread(bool threaded, U32 pool_size) { // Using number of (virtual) cores - 1 (for the main image worker // thread). - --pool_size; + pool_size = llclamp(pool_size, 0U, 2U); + } + else + { + pool_size = 0; } } else if (pool_size == 1) // Disable if only 1 @@ -334,9 +340,8 @@ bool LLImageDecodeThread::ImageRequest::tut_isOK() bool LLImageDecodeThread::enqueRequest(ImageRequest * req) { - for (U32 i = 0, count = mThreadPool.size(); i < count; ++i) { - if (mLastPoolAllocation >= count) + if (mLastPoolAllocation >= mThreadPool.size()) { mLastPoolAllocation = 0; }