Fix bugs in thread termination causing occasional pthread
[dcpomatic.git] / src / lib / encode_server.cc
index c30fc8f30323ae52682682e2332c9fcb0e09300a..f4224798bce211f423574aed7c0496ecb1e0958e 100644 (file)
@@ -83,6 +83,8 @@ EncodeServer::EncodeServer (bool verbose, int num_threads)
 
 EncodeServer::~EncodeServer ()
 {
+       boost::this_thread::disable_interruption dis;
+
        {
                boost::mutex::scoped_lock lm (_mutex);
                _terminate = true;
@@ -104,13 +106,9 @@ EncodeServer::~EncodeServer ()
        }
 
        _broadcast.io_service.stop ();
-       if (_broadcast.thread.joinable()) {
-               try {
-                       _broadcast.thread.join ();
-               } catch (...) {
-
-               }
-       }
+       try {
+               _broadcast.thread.join ();
+       } catch (...) {}
 }
 
 /** @param after_read Filled in with gettimeofday() after reading the input from the network.