Try to speed up cancel of encoder threads if they are sleeping for remote backoff.
authorCarl Hetherington <cth@carlh.net>
Wed, 9 Dec 2015 14:29:47 +0000 (14:29 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 9 Dec 2015 14:29:47 +0000 (14:29 +0000)
src/lib/encoder.cc

index b03a2ce6aa3b1ac889eab1acea2b80f3415a09f0..451a5a31adc84549ad61d5416c14f39713a83384 100644 (file)
@@ -257,13 +257,12 @@ Encoder::terminate_threads ()
        {
                boost::mutex::scoped_lock queue_lock (_queue_mutex);
                _terminate_encoding = true;
-               _full_condition.notify_all ();
-               _empty_condition.notify_all ();
        }
 
        boost::mutex::scoped_lock threads_lock (_threads_mutex);
 
        for (list<boost::thread *>::iterator i = _threads.begin(); i != _threads.end(); ++i) {
+               (*i)->interrupt ();
                if ((*i)->joinable ()) {
                        (*i)->join ();
                }
@@ -356,7 +355,7 @@ try
                }
 
                if (remote_backoff > 0) {
-                       dcpomatic_sleep (remote_backoff);
+                       boost::this_thread::sleep_for (boost::chrono::seconds (remote_backoff));
                }
 
                /* The queue might not be full any more, so notify anything that is waiting on that */