X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fchecker.cc;h=c32462b42b57c8bd9c4da0e448e950adb8e6f4ed;hb=561eed2dc9978e890a020b6435ceb0333bb69a61;hp=13d9aacee314c6278bdb7405a8323d44ce873259;hpb=264583479e79b481251f1772b228f82cd77552d3;p=dcpomatic.git diff --git a/src/lib/checker.cc b/src/lib/checker.cc index 13d9aacee..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 @@ -81,7 +74,7 @@ Checker::thread () } lm.unlock (); - dcpomatic_sleep (_period); + dcpomatic_sleep_seconds (_period); } }