Merge pull request #6757

6a37da8 threadpool: guard against exceptions in jobs, and armour plating (moneromooo-monero)
This commit is contained in:
luigi1111
2020-09-03 12:25:59 -05:00
8 changed files with 72 additions and 60 deletions
+5 -3
View File
@@ -985,7 +985,7 @@ namespace cryptonote
CRITICAL_REGION_LOCAL(m_incoming_tx_lock);
tools::threadpool& tpool = tools::threadpool::getInstance();
tools::threadpool::waiter waiter;
tools::threadpool::waiter waiter(tpool);
epee::span<tx_blob_entry>::const_iterator it = tx_blobs.begin();
for (size_t i = 0; i < tx_blobs.size(); i++, ++it) {
tpool.submit(&waiter, [&, i, it] {
@@ -1001,7 +1001,8 @@ namespace cryptonote
}
});
}
waiter.wait(&tpool);
if (!waiter.wait())
return false;
it = tx_blobs.begin();
std::vector<bool> already_have(tx_blobs.size(), false);
for (size_t i = 0; i < tx_blobs.size(); i++, ++it) {
@@ -1033,7 +1034,8 @@ namespace cryptonote
});
}
}
waiter.wait(&tpool);
if (!waiter.wait())
return false;
std::vector<tx_verification_batch_info> tx_info;
tx_info.reserve(tx_blobs.size());