From 576b7e8eee6c17a5a7f0f4c3bfb1787768f4f276 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 6 Jul 2018 23:31:35 +0100 Subject: [PATCH] Missing wakeups of the writer thread when we are waiting for it do something. --- src/lib/writer.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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); } -- 2.30.2