diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-07-03 20:36:20 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-07-03 20:36:20 +0100 |
| commit | 8862cbbb7e857c90d405069ad7d41a8d58029194 (patch) | |
| tree | ebce1a0209f05784f96321be82236d28b647e37a /src | |
| parent | a4c5a9ff48c4cec51e3488f4f8692bf2a2f82dca (diff) | |
Remove several exception-throwing asserts from destructors.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/encode_server.cc | 16 | ||||
| -rw-r--r-- | src/lib/encode_server_finder.cc | 16 | ||||
| -rw-r--r-- | src/lib/job_manager.cc | 8 | ||||
| -rw-r--r-- | src/lib/update_checker.cc | 8 |
4 files changed, 36 insertions, 12 deletions
diff --git a/src/lib/encode_server.cc b/src/lib/encode_server.cc index f318da03b..7e0152003 100644 --- a/src/lib/encode_server.cc +++ b/src/lib/encode_server.cc @@ -85,15 +85,23 @@ EncodeServer::~EncodeServer () } BOOST_FOREACH (boost::thread* i, _worker_threads) { - DCPOMATIC_ASSERT (i->joinable ()); - i->join (); + /* Ideally this would be a DCPOMATIC_ASSERT(i->joinable()) but we + can't throw exceptions from a destructor. + */ + if (i->joinable ()) { + i->join (); + } delete i; } _broadcast.io_service.stop (); if (_broadcast.thread) { - DCPOMATIC_ASSERT (_broadcast.thread->joinable ()); - _broadcast.thread->join (); + /* Ideally this would be a DCPOMATIC_ASSERT(_broadcast.thread->joinable()) but we + can't throw exceptions from a destructor. + */ + if (_broadcast.thread->joinable ()) { + _broadcast.thread->join (); + } } } diff --git a/src/lib/encode_server_finder.cc b/src/lib/encode_server_finder.cc index 7491d9ef7..eebf404fa 100644 --- a/src/lib/encode_server_finder.cc +++ b/src/lib/encode_server_finder.cc @@ -64,14 +64,22 @@ EncodeServerFinder::~EncodeServerFinder () _search_condition.notify_all (); if (_search_thread) { - DCPOMATIC_ASSERT (_search_thread->joinable ()); - _search_thread->join (); + /* Ideally this would be a DCPOMATIC_ASSERT(_search_thread->joinable()) but we + can't throw exceptions from a destructor. + */ + if (_search_thread->joinable ()) { + _search_thread->join (); + } } _listen_io_service.stop (); if (_listen_thread) { - DCPOMATIC_ASSERT (_listen_thread->joinable ()); - _listen_thread->join (); + /* Ideally this would be a DCPOMATIC_ASSERT(_listen_thread->joinable()) but we + can't throw exceptions from a destructor. + */ + if (_listen_thread->joinable ()) { + _listen_thread->join (); + } } } diff --git a/src/lib/job_manager.cc b/src/lib/job_manager.cc index 08c744e07..c9924d226 100644 --- a/src/lib/job_manager.cc +++ b/src/lib/job_manager.cc @@ -63,8 +63,12 @@ JobManager::~JobManager () } if (_scheduler) { - DCPOMATIC_ASSERT (_scheduler->joinable ()); - _scheduler->join (); + /* Ideally this would be a DCPOMATIC_ASSERT(_scheduler->joinable()) but we + can't throw exceptions from a destructor. + */ + if (_scheduler->joinable ()) { + _scheduler->join (); + } } delete _scheduler; diff --git a/src/lib/update_checker.cc b/src/lib/update_checker.cc index e3bbd663e..58bc7c1b7 100644 --- a/src/lib/update_checker.cc +++ b/src/lib/update_checker.cc @@ -86,8 +86,12 @@ UpdateChecker::~UpdateChecker () _condition.notify_all (); if (_thread) { - DCPOMATIC_ASSERT (_thread->joinable ()); - _thread->join (); + /* Ideally this would be a DCPOMATIC_ASSERT(_thread->joinable()) but we + can't throw exceptions from a destructor. + */ + if (_thread->joinable ()) { + _thread->join (); + } } delete _thread; |
