diff --git a/indra/llcommon/threadpool.cpp b/indra/llcommon/threadpool.cpp index 1899f9a20aef45e4a18953891c8d0a0d8e2cd5ff..e4fa0eccf393fd1a8279ee7cbd1e6fbe3e5bb22b 100644 --- a/indra/llcommon/threadpool.cpp +++ b/indra/llcommon/threadpool.cpp @@ -21,8 +21,8 @@ #include "llevents.h" #include "stringize.h" -LL::ThreadPool::ThreadPool(const std::string& name, size_t threads): - mQueue(name), +LL::ThreadPool::ThreadPool(const std::string& name, size_t threads, size_t capacity): + mQueue(name, capacity), mName("ThreadPool:" + name) { for (size_t i = 0; i < threads; ++i) diff --git a/indra/llcommon/threadpool.h b/indra/llcommon/threadpool.h index 8f3c8514b5713cf0477193bfff44cf5e4fdecf95..6e3858508bf2d2f7939a0027e033878a407b3ec4 100644 --- a/indra/llcommon/threadpool.h +++ b/indra/llcommon/threadpool.h @@ -29,7 +29,7 @@ namespace LL * Pass ThreadPool a string name. This can be used to look up the * relevant WorkQueue. */ - ThreadPool(const std::string& name, size_t threads=1); + ThreadPool(const std::string& name, size_t threads=1, size_t capacity=1024); ~ThreadPool(); void close(); diff --git a/indra/llcommon/workqueue.cpp b/indra/llcommon/workqueue.cpp index 9808757b0abb04d1893983504b546c4c68dca6ff..14ae4c4ab826e752d18501bb74556f97d45dd223 100644 --- a/indra/llcommon/workqueue.cpp +++ b/indra/llcommon/workqueue.cpp @@ -26,8 +26,9 @@ using Mutex = LLCoros::Mutex; using Lock = LLCoros::LockType; -LL::WorkQueue::WorkQueue(const std::string& name): - super(makeName(name)) +LL::WorkQueue::WorkQueue(const std::string& name, size_t capacity): + super(makeName(name)), + mQueue(capacity) { // TODO: register for "LLApp" events so we can implicitly close() on // viewer shutdown. diff --git a/indra/llcommon/workqueue.h b/indra/llcommon/workqueue.h index d0e3f870fe3f1eee477dbdfbc59a6c846283bb72..5987883829b8c6569d72f3157eb6d050a3ee95cb 100644 --- a/indra/llcommon/workqueue.h +++ b/indra/llcommon/workqueue.h @@ -54,7 +54,7 @@ namespace LL * You may omit the WorkQueue name, in which case a unique name is * synthesized; for practical purposes that makes it anonymous. */ - WorkQueue(const std::string& name = std::string()); + WorkQueue(const std::string& name = std::string(), size_t capacity=1024); /** * Since the point of WorkQueue is to pass work to some other worker diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index ea2e3a4007836192fdc334eccb7b0b7c2bc7beef..02b4dd57f1aa1d0a9d0af985265be7bf00e4bfd8 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -367,7 +367,9 @@ BOOL gLogoutInProgress = FALSE; BOOL gSimulateMemLeak = FALSE; -WorkQueue gMainloopWork("mainloop"); +// We don't want anyone, especially threads working on the graphics pipeline, +// to have to block due to this WorkQueue being full. +WorkQueue gMainloopWork("mainloop", 1024*1024); //////////////////////////////////////////////////////////// // Internal globals... that should be removed. diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 13e7fcb6e4c02cf2a900d99ff4223d4d4fda9569..9a4149948c4f128d498e4a1f185cf16a8481c56f 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -313,7 +313,9 @@ void launchThreadPool() << size << " threads" << LL_ENDL; // Use a function-static ThreadPool: static duration, but instantiated // only on demand. - static LL::ThreadPool pool("General", size); + // We don't want anyone, especially the main thread, to have to block + // due to this ThreadPool being full. + static LL::ThreadPool pool("General", size, 1024*1024); } void update_texture_fetch()