summaryrefslogtreecommitdiff
path: root/indra/llcommon/threadpool.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llcommon/threadpool.h')
-rw-r--r--indra/llcommon/threadpool.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/indra/llcommon/threadpool.h b/indra/llcommon/threadpool.h
index 60f4a0ce1b..74056aea17 100644
--- a/indra/llcommon/threadpool.h
+++ b/indra/llcommon/threadpool.h
@@ -40,7 +40,7 @@ namespace LL
* overrides this parameter.
*/
ThreadPoolBase(const std::string& name, size_t threads,
- WorkQueueBase* queue);
+ WorkQueueBase* queue, bool auto_shutdown = true);
virtual ~ThreadPoolBase();
/**
@@ -55,7 +55,7 @@ namespace LL
* ThreadPool listens for application shutdown messages on the "LLApp"
* LLEventPump. Call close() to shut down this ThreadPool early.
*/
- void close();
+ virtual void close();
std::string getName() const { return mName; }
size_t getWidth() const { return mThreads.size(); }
@@ -87,13 +87,14 @@ namespace LL
protected:
std::unique_ptr<WorkQueueBase> mQueue;
+ std::vector<std::pair<std::string, std::thread>> mThreads;
+ bool mAutomaticShutdown;
private:
void run(const std::string& name);
std::string mName;
size_t mThreadCount;
- std::vector<std::pair<std::string, std::thread>> mThreads;
};
/**
@@ -117,8 +118,11 @@ namespace LL
* Constraining the queue can cause a submitter to block. Do not
* constrain any ThreadPool accepting work from the main thread.
*/
- ThreadPoolUsing(const std::string& name, size_t threads=1, size_t capacity=1024*1024):
- ThreadPoolBase(name, threads, new queue_t(name, capacity))
+ ThreadPoolUsing(const std::string& name,
+ size_t threads=1,
+ size_t capacity=1024*1024,
+ bool auto_shutdown = true):
+ ThreadPoolBase(name, threads, new queue_t(name, capacity), auto_shutdown)
{}
~ThreadPoolUsing() override {}