Give control over thread queue's automatic shutdown
parent
f52b281f00
commit
9117a37c3d
|
|
@ -122,7 +122,7 @@ namespace LL
|
|||
size_t threads=1,
|
||||
size_t capacity=1024*1024,
|
||||
bool auto_shutdown = true):
|
||||
ThreadPoolBase(name, threads, new queue_t(name, capacity), auto_shutdown)
|
||||
ThreadPoolBase(name, threads, new queue_t(name, capacity, false), auto_shutdown)
|
||||
{}
|
||||
~ThreadPoolUsing() override {}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,12 +29,15 @@ 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))
|
||||
{
|
||||
if (auto_shutdown)
|
||||
{
|
||||
// TODO: register for "LLApp" events so we can implicitly close() on
|
||||
// viewer shutdown.
|
||||
}
|
||||
}
|
||||
|
||||
void LL::WorkQueueBase::runUntilClose()
|
||||
{
|
||||
|
|
@ -135,8 +138,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)
|
||||
{
|
||||
}
|
||||
|
|
@ -184,8 +187,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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace LL
|
|||
* You may omit the WorkQueueBase name, in which case a unique name is
|
||||
* synthesized; for practical purposes that makes it anonymous.
|
||||
*/
|
||||
WorkQueueBase(const std::string& name);
|
||||
WorkQueueBase(const std::string& name, bool auto_shutdown);
|
||||
|
||||
/**
|
||||
* Since the point of WorkQueue is to pass work to some other worker
|
||||
|
|
@ -212,7 +212,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(), size_t capacity=1024);
|
||||
WorkQueue(const std::string& name = std::string(), size_t capacity=1024, bool auto_shutdown = true);
|
||||
|
||||
/**
|
||||
* Since the point of WorkQueue is to pass work to some other worker
|
||||
|
|
@ -282,7 +282,7 @@ namespace LL
|
|||
* You may omit the WorkSchedule name, in which case a unique name is
|
||||
* synthesized; for practical purposes that makes it anonymous.
|
||||
*/
|
||||
WorkSchedule(const std::string& name = std::string(), size_t capacity=1024);
|
||||
WorkSchedule(const std::string& name = std::string(), size_t capacity=1024, bool auto_shutdown = true);
|
||||
|
||||
/**
|
||||
* Since the point of WorkSchedule is to pass work to some other worker
|
||||
|
|
|
|||
Loading…
Reference in New Issue