diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-01-30 22:54:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-01-30 22:54:38 +0100 |
| commit | ea6b2dae46caa1da829fbf499e83cd6ae3b3773a (patch) | |
| tree | f8f978b762fad664a4c8d5fdc11d8c7145ee09a8 /src/lib/checker.cc | |
| parent | a1546fb6c4e59621d99271b8ca996e96a574f7b3 (diff) | |
Various thread cleanups.
Diffstat (limited to 'src/lib/checker.cc')
| -rw-r--r-- | src/lib/checker.cc | 21 |
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 |
