summaryrefslogtreecommitdiff
path: root/indra/llcommon/workqueue.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-10-31 02:30:54 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-10-31 16:49:47 +0200
commiteccc9057d9d9799d3d5056bdfe255bd9e5e2be6a (patch)
tree704137570160b6a4a8fcc9d68485c7ab5e64bdf2 /indra/llcommon/workqueue.cpp
parent9c0a6d1b0e5e9d6da6a63ff367f40ab08c064bbe (diff)
Give control over thread queue's automatic shutdown
Diffstat (limited to 'indra/llcommon/workqueue.cpp')
-rw-r--r--indra/llcommon/workqueue.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/indra/llcommon/workqueue.cpp b/indra/llcommon/workqueue.cpp
index 8b7b97a1f9..e5ebd5ee45 100644
--- a/indra/llcommon/workqueue.cpp
+++ b/indra/llcommon/workqueue.cpp
@@ -29,14 +29,17 @@ using Lock = LLCoros::LockType;
/*****************************************************************************
* WorkQueueBase
*****************************************************************************/
-LL::WorkQueueBase::WorkQueueBase(const std::string& name):
- super(makeName(name))
+LL::WorkQueueBase::WorkQueueBase(const std::string& name, bool auto_shutdown)
+ : super(makeName(name))
{
- // Register for status change events so we'll implicitly close() on viewer
- // shutdown.
- mStopListener = LLCoros::getStopListener(
- "WorkQueue:" + getKey(),
- [this](const LLSD&){ close(); });
+ if (auto_shutdown)
+ {
+ // Register for status change events so we'll implicitly close() on viewer
+ // shutdown.
+ mStopListener = LLCoros::getStopListener(
+ "WorkQueue:" + getKey(),
+ [this](const LLSD&) { close(); });
+ }
}
void LL::WorkQueueBase::runUntilClose()
@@ -136,8 +139,8 @@ void LL::WorkQueueBase::checkCoroutine(const std::string& method)
/*****************************************************************************
* WorkQueue
*****************************************************************************/
-LL::WorkQueue::WorkQueue(const std::string& name, size_t capacity):
- super(name),
+LL::WorkQueue::WorkQueue(const std::string& name, size_t capacity, bool auto_shutdown):
+ super(name, auto_shutdown),
mQueue(capacity)
{
}
@@ -185,8 +188,8 @@ bool LL::WorkQueue::tryPop_(Work& work)
/*****************************************************************************
* WorkSchedule
*****************************************************************************/
-LL::WorkSchedule::WorkSchedule(const std::string& name, size_t capacity):
- super(name),
+LL::WorkSchedule::WorkSchedule(const std::string& name, size_t capacity, bool auto_shutdown):
+ super(name, auto_shutdown),
mQueue(capacity)
{
}