Skip to content

Commit 459e208

Browse files
committed
Exit early for an empty vChecks in CCheckQueue::Add
1 parent c43aa62 commit 459e208

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/checkqueue.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ class CCheckQueue
167167
//! Add a batch of checks to the queue
168168
void Add(std::vector<T>& vChecks)
169169
{
170+
if (vChecks.empty()) {
171+
return;
172+
}
173+
170174
{
171175
LOCK(m_mutex);
172176
for (T& check : vChecks) {
@@ -176,10 +180,11 @@ class CCheckQueue
176180
nTodo += vChecks.size();
177181
}
178182

179-
if (vChecks.size() == 1)
183+
if (vChecks.size() == 1) {
180184
m_worker_cv.notify_one();
181-
else if (vChecks.size() > 1)
185+
} else {
182186
m_worker_cv.notify_all();
187+
}
183188
}
184189

185190
//! Stop all of the worker threads.

0 commit comments

Comments
 (0)