Skip to content

Commit

Permalink
Exit early for an empty vChecks in CCheckQueue::Add
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Nov 3, 2021
1 parent c43aa62 commit 459e208
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/checkqueue.h
Expand Up @@ -167,6 +167,10 @@ class CCheckQueue
//! 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) {
Expand All @@ -176,10 +180,11 @@ class CCheckQueue
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.
Expand Down

0 comments on commit 459e208

Please sign in to comment.