diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2024-05-30 15:39:01 +0300 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2024-05-30 15:39:38 +0300 |
commit | f2f3ed08db9709fbb0f4c48c0d9e39c450207383 (patch) | |
tree | ed19aa9aa0b2424d4fcb027c065871c1922ff45a /indra/llcommon/threadpool.cpp | |
parent | 83d91c82f42f6c024e7e4dc6d6a64b067ad6117a (diff) | |
parent | 316bc0bdf30514a0c6894ef7c2859e79bf02a546 (diff) |
Merge branch release/luau-scripting
Diffstat (limited to 'indra/llcommon/threadpool.cpp')
-rw-r--r-- | indra/llcommon/threadpool.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/indra/llcommon/threadpool.cpp b/indra/llcommon/threadpool.cpp index edccdb097b..0f445b84fb 100644 --- a/indra/llcommon/threadpool.cpp +++ b/indra/llcommon/threadpool.cpp @@ -109,20 +109,19 @@ LL::ThreadPoolBase::~ThreadPoolBase() void LL::ThreadPoolBase::close() { - if (! mQueue->isClosed()) + // mQueue might have been closed already, but in any case we must join or + // detach each of our threads before destroying the mThreads vector. + LL_DEBUGS("ThreadPool") << mName << " closing queue and joining threads" << LL_ENDL; + mQueue->close(); + for (auto& pair: mThreads) { - LL_DEBUGS("ThreadPool") << mName << " closing queue and joining threads" << LL_ENDL; - mQueue->close(); - for (auto& pair: mThreads) + if (pair.second.joinable()) { - if (pair.second.joinable()) - { - LL_DEBUGS("ThreadPool") << mName << " waiting on thread " << pair.first << LL_ENDL; - pair.second.join(); - } + LL_DEBUGS("ThreadPool") << mName << " waiting on thread " << pair.first << LL_ENDL; + pair.second.join(); } - LL_DEBUGS("ThreadPool") << mName << " shutdown complete" << LL_ENDL; } + LL_DEBUGS("ThreadPool") << mName << " shutdown complete" << LL_ENDL; } void LL::ThreadPoolBase::run(const std::string& name) |