mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-28 04:52:36 +02:00
Avoid excessive lock contention in CCheckQueue::Add
This commit is contained in:
parent
7efc628539
commit
c43aa62343
@ -167,12 +167,15 @@ public:
|
||||
//! Add a batch of checks to the queue
|
||||
void Add(std::vector<T>& vChecks)
|
||||
{
|
||||
LOCK(m_mutex);
|
||||
for (T& check : vChecks) {
|
||||
queue.push_back(T());
|
||||
check.swap(queue.back());
|
||||
{
|
||||
LOCK(m_mutex);
|
||||
for (T& check : vChecks) {
|
||||
queue.emplace_back();
|
||||
check.swap(queue.back());
|
||||
}
|
||||
nTodo += vChecks.size();
|
||||
}
|
||||
nTodo += vChecks.size();
|
||||
|
||||
if (vChecks.size() == 1)
|
||||
m_worker_cv.notify_one();
|
||||
else if (vChecks.size() > 1)
|
||||
|
Loading…
Reference in New Issue
Block a user