diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-10-30 19:33:09 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2021-11-03 11:26:57 +0200 |
commit | 459e208276a4d1457d37bf41c977e62caf05456d (patch) | |
tree | 3d4eb0575ba49f171164a907fd5d8eef04c45ee9 | |
parent | c43aa623435a277a692dbde784e8a7146f5573e9 (diff) | |
download | bitcoin-459e208276a4d1457d37bf41c977e62caf05456d.tar.xz |
Exit early for an empty vChecks in CCheckQueue::Add
-rw-r--r-- | src/checkqueue.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/checkqueue.h b/src/checkqueue.h index d926326a95..760dfbddc1 100644 --- a/src/checkqueue.h +++ b/src/checkqueue.h @@ -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,10 +180,11 @@ 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. |