aboutsummaryrefslogtreecommitdiff
path: root/src/common/threadpool.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-02-02 16:16:43 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-02-02 16:27:39 +0000
commit9b98a6ac8f750f5d786fe9a3a561373ca64e5049 (patch)
tree4b06a11ec86967f21b134990291307e1f71987ea /src/common/threadpool.h
parentblockchain_export: fix buffer overflow in exporter (diff)
downloadmonero-9b98a6ac8f750f5d786fe9a3a561373ca64e5049.tar.xz
threadpool: catch exceptions in dtor, to avoid terminate
If an exception is thrown, it is ignored. While this may hide a bug, this should only be system exceptions in boost, which is pretty unlikely. Morever, wait should be called manually before the dtor anyway. Add an error message if the dtor has to wait in case some such cases creep in so they get fixed. Coverity 182538
Diffstat (limited to 'src/common/threadpool.h')
-rw-r--r--src/common/threadpool.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/threadpool.h b/src/common/threadpool.h
index a0e53b011..34152541c 100644
--- a/src/common/threadpool.h
+++ b/src/common/threadpool.h
@@ -34,6 +34,7 @@
#include <functional>
#include <utility>
#include <vector>
+#include <stdexcept>
namespace tools
{
@@ -57,7 +58,7 @@ public:
void dec();
void wait(); //! Wait for a set of tasks to finish.
waiter() : num(0){}
- ~waiter() { wait(); }
+ ~waiter();
};
// Submit a task to the pool. The waiter pointer may be