Exit early for an empty vChecks in CCheckQueue::Add

This commit is contained in:
Hennadii Stepanov 2021-10-30 19:33:09 +03:00
parent c43aa62343
commit 459e208276
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

View File

@ -167,6 +167,10 @@ public:
//! Add a batch of checks to the queue
void Add(std::vector<T>& vChecks)
{
if (vChecks.empty()) {
return;
}
{
LOCK(m_mutex);
for (T& check : vChecks) {
@ -176,11 +180,12 @@ public:
nTodo += vChecks.size();
}
if (vChecks.size() == 1)
if (vChecks.size() == 1) {
m_worker_cv.notify_one();
else if (vChecks.size() > 1)
} else {
m_worker_cv.notify_all();
}
}
//! Stop all of the worker threads.
void StopWorkerThreads()