summaryrefslogtreecommitdiff
path: root/src/lib/writer.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-06-26 23:36:24 +0100
committerCarl Hetherington <cth@carlh.net>2014-06-26 23:36:24 +0100
commit4616b19fb5241a54c9d57f7a91bb975f41aed14b (patch)
treed067450cb12dd3629fe88ef9a578c6b1cabe7884 /src/lib/writer.cc
parentf1d30fb114b3b2c6ccd8fdf5823e7cd6b26c1eef (diff)
parent20fa26ea6ecfdbecea8bb1230c8388cce3fd521f (diff)
Merge master.
Diffstat (limited to 'src/lib/writer.cc')
-rw-r--r--src/lib/writer.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 580dfe4f2..33817ca6e 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -139,6 +139,7 @@ Writer::write (shared_ptr<const EncodedData> encoded, int frame, Eyes eyes)
boost::mutex::scoped_lock lock (_mutex);
while (_queued_full_in_memory > _maximum_frames_in_memory) {
+ /* The queue is too big; wait until that is sorted out */
_full_condition.wait (lock);
}
@@ -160,7 +161,8 @@ Writer::write (shared_ptr<const EncodedData> encoded, int frame, Eyes eyes)
_queue.push_back (qi);
++_queued_full_in_memory;
}
-
+
+ /* Now there's something to do: wake anything wait()ing on _empty_condition */
_empty_condition.notify_all ();
}
@@ -170,6 +172,7 @@ Writer::fake_write (int frame, Eyes eyes)
boost::mutex::scoped_lock lock (_mutex);
while (_queued_full_in_memory > _maximum_frames_in_memory) {
+ /* The queue is too big; wait until that is sorted out */
_full_condition.wait (lock);
}
@@ -191,6 +194,7 @@ Writer::fake_write (int frame, Eyes eyes)
_queue.push_back (qi);
}
+ /* Now there's something to do: wake anything wait()ing on _empty_condition */
_empty_condition.notify_all ();
}
@@ -244,9 +248,11 @@ try
while (1) {
if (_finish || _queued_full_in_memory > _maximum_frames_in_memory || have_sequenced_image_at_queue_head ()) {
+ /* We've got something to do: go and do it */
break;
}
+ /* Nothing to do: wait until something happens which may indicate that we do */
LOG_TIMING (N_("writer sleeps with a queue of %1"), _queue.size());
_empty_condition.wait (lock);
LOG_TIMING (N_("writer wakes with a queue of %1"), _queue.size());
@@ -336,6 +342,7 @@ try
--_queued_full_in_memory;
}
+ /* The queue has probably just gone down a bit; notify anything wait()ing on _full_condition */
_full_condition.notify_all ();
}
}