summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2021-11-04 17:18:57 -0400
committerNat Goodspeed <nat@lindenlab.com>2021-11-04 17:18:57 -0400
commit834e7ca088b5f417235327cd290b42459c733594 (patch)
treed28886376102be6857bf9fc3af05746917ed2abe /indra
parentd848d9e888690210dd37a40c634820fd473699fb (diff)
SL-16202: Use large WorkQueue size limits for mainloop and General.
Give ThreadPool and WorkQueue the ability to override default ThreadSafeSchedule capacity. Instantiate "mainloop" WorkQueue and "General" ThreadPool with very large capacity because we never want to have to block trying to push to either.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/threadpool.cpp4
-rw-r--r--indra/llcommon/threadpool.h2
-rw-r--r--indra/llcommon/workqueue.cpp5
-rw-r--r--indra/llcommon/workqueue.h2
-rw-r--r--indra/newview/llappviewer.cpp4
-rw-r--r--indra/newview/llstartup.cpp4
6 files changed, 13 insertions, 8 deletions
diff --git a/indra/llcommon/threadpool.cpp b/indra/llcommon/threadpool.cpp
index 1899f9a20a..e4fa0eccf3 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 8f3c8514b5..6e3858508b 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 9808757b0a..14ae4c4ab8 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 d0e3f870fe..5987883829 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 ea2e3a4007..02b4dd57f1 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 13e7fcb6e4..9a4149948c 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()