mirror of
https://github.com/monero-project/monero.git
synced 2025-08-13 05:05:30 -04:00
Catch more exceptions in dtors
Misc coverity reports
This commit is contained in:
parent
83d8f03c23
commit
e5108a294a
17 changed files with 43 additions and 1 deletions
|
@ -51,11 +51,19 @@ threadpool::threadpool(unsigned int max_threads) : running(true), active(0) {
|
|||
}
|
||||
|
||||
threadpool::~threadpool() {
|
||||
try
|
||||
{
|
||||
const boost::unique_lock<boost::mutex> lock(mutex);
|
||||
running = false;
|
||||
has_work.notify_all();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// if the lock throws, we're just do it without a lock and hope,
|
||||
// since the alternative is terminate
|
||||
running = false;
|
||||
has_work.notify_all();
|
||||
}
|
||||
for (size_t i = 0; i<threads.size(); i++) {
|
||||
try { threads[i].join(); }
|
||||
catch (...) { /* ignore */ }
|
||||
|
@ -91,11 +99,13 @@ unsigned int threadpool::get_max_concurrency() const {
|
|||
|
||||
threadpool::waiter::~waiter()
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lock(mt);
|
||||
if (num)
|
||||
MERROR("wait should have been called before waiter dtor - waiting now");
|
||||
}
|
||||
catch (...) { /* ignore */ }
|
||||
try
|
||||
{
|
||||
wait(NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue