Make CCheckQueue destructor stop worker threads

This commit is contained in:
Hennadii Stepanov
2023-07-07 10:37:36 +01:00
parent be4ff3060b
commit d03eaacbcf
9 changed files with 2 additions and 29 deletions

View File

@@ -179,24 +179,16 @@ public:
}
}
//! Stop all of the worker threads.
void StopWorkerThreads() EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
~CCheckQueue()
{
WITH_LOCK(m_mutex, m_request_stop = true);
m_worker_cv.notify_all();
for (std::thread& t : m_worker_threads) {
t.join();
}
m_worker_threads.clear();
WITH_LOCK(m_mutex, m_request_stop = false);
}
bool HasThreads() const { return !m_worker_threads.empty(); }
~CCheckQueue()
{
assert(m_worker_threads.empty());
}
};
/**