From: Carl Hetherington Date: Fri, 6 Jul 2018 22:31:35 +0000 (+0100) Subject: Missing wakeups of the writer thread when we are waiting for it do something. X-Git-Tag: v2.13.34^0 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=576b7e8eee6c17a5a7f0f4c3bfb1787768f4f276 Missing wakeups of the writer thread when we are waiting for it do something. --- diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 96fb9e179..cd5b6d7e0 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -130,7 +130,9 @@ Writer::write (Data encoded, Frame frame, Eyes eyes) boost::mutex::scoped_lock lock (_state_mutex); while (_queued_full_in_memory > _maximum_frames_in_memory) { - /* There are too many full frames in memory; wait until that is sorted out */ + /* There are too many full frames in memory; wake the main writer thread and + wait until it sorts everything out */ + _empty_condition.notify_all (); _full_condition.wait (lock); } @@ -175,8 +177,9 @@ Writer::repeat (Frame frame, Eyes eyes) while (_queue.size() > _maximum_queue_size && have_sequenced_image_at_queue_head()) { /* The queue is too big, and the main writer thread can run and fix it, so - wait until it has done. + wake it and wait until it has done. */ + _empty_condition.notify_all (); _full_condition.wait (lock); } @@ -205,8 +208,9 @@ Writer::fake_write (Frame frame, Eyes eyes) while (_queue.size() > _maximum_queue_size && have_sequenced_image_at_queue_head()) { /* The queue is too big, and the main writer thread can run and fix it, so - wait until it has done. + wake it and wait until it has done. */ + _empty_condition.notify_all (); _full_condition.wait (lock); }