mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 12:22:39 -03:00
Exit early for an empty vChecks in CCheckQueue::Add
This commit is contained in:
parent
c43aa62343
commit
459e208276
1 changed files with 7 additions and 2 deletions
|
@ -167,6 +167,10 @@ public:
|
||||||
//! Add a batch of checks to the queue
|
//! Add a batch of checks to the queue
|
||||||
void Add(std::vector<T>& vChecks)
|
void Add(std::vector<T>& vChecks)
|
||||||
{
|
{
|
||||||
|
if (vChecks.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(m_mutex);
|
LOCK(m_mutex);
|
||||||
for (T& check : vChecks) {
|
for (T& check : vChecks) {
|
||||||
|
@ -176,10 +180,11 @@ public:
|
||||||
nTodo += vChecks.size();
|
nTodo += vChecks.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vChecks.size() == 1)
|
if (vChecks.size() == 1) {
|
||||||
m_worker_cv.notify_one();
|
m_worker_cv.notify_one();
|
||||||
else if (vChecks.size() > 1)
|
} else {
|
||||||
m_worker_cv.notify_all();
|
m_worker_cv.notify_all();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Stop all of the worker threads.
|
//! Stop all of the worker threads.
|
||||||
|
|
Loading…
Reference in a new issue