summaryrefslogtreecommitdiff
path: root/src/lib/checker.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-01-30 22:54:38 +0100
committerCarl Hetherington <cth@carlh.net>2020-01-30 22:54:38 +0100
commitea6b2dae46caa1da829fbf499e83cd6ae3b3773a (patch)
treef8f978b762fad664a4c8d5fdc11d8c7145ee09a8 /src/lib/checker.cc
parenta1546fb6c4e59621d99271b8ca996e96a574f7b3 (diff)
Various thread cleanups.
Diffstat (limited to 'src/lib/checker.cc')
-rw-r--r--src/lib/checker.cc21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/lib/checker.cc b/src/lib/checker.cc
index 2d15dd3f1..c32462b42 100644
--- a/src/lib/checker.cc
+++ b/src/lib/checker.cc
@@ -28,8 +28,7 @@ using boost::bind;
using boost::ref;
Checker::Checker (int period)
- : _thread (0)
- , _terminate (false)
+ : _terminate (false)
, _ok (true)
, _period (period)
{
@@ -39,7 +38,7 @@ Checker::Checker (int period)
void
Checker::run ()
{
- _thread = new boost::thread (boost::bind (&Checker::thread, this));
+ _thread = boost::thread (boost::bind(&Checker::thread, this));
}
Checker::~Checker ()
@@ -49,20 +48,14 @@ Checker::~Checker ()
_terminate = true;
}
- if (_thread) {
- /* Ideally this would be a DCPOMATIC_ASSERT(_thread->joinable()) but we
- can't throw exceptions from a destructor.
- */
- _thread->interrupt ();
+ if (_thread.joinable()) {
+ _thread.interrupt ();
try {
- if (_thread->joinable ()) {
- _thread->join ();
- }
- } catch (boost::thread_interrupted& e) {
- /* No problem */
+ _thread.join ();
+ } catch (...) {
+
}
}
- delete _thread;
}
void