Fix bugs in thread termination causing occasional pthread
[dcpomatic.git] / src / lib / encode_server_finder.cc
index 52c8c89496bdec9b46bb5de1487b06d48907eed8..7297734ecf892c9e9051d6fcdd20c4edba383fc9 100644 (file)
@@ -70,25 +70,19 @@ EncodeServerFinder::~EncodeServerFinder ()
 void
 EncodeServerFinder::stop ()
 {
+       boost::this_thread::disable_interruption dis;
+
        _stop = true;
 
        _search_condition.notify_all ();
-       if (_search_thread.joinable()) {
-               try {
-                       _search_thread.join();
-               } catch (...) {
-
-               }
-       }
+       try {
+               _search_thread.join();
+       } catch (...) {}
 
        _listen_io_service.stop ();
-       if (_listen_thread.joinable()) {
-               try {
-                       _listen_thread.join ();
-               } catch (...) {
-
-               }
-       }
+       try {
+               _listen_thread.join ();
+       } catch (...) {}
 
        boost::mutex::scoped_lock lm (_servers_mutex);
        _servers.clear ();