summaryrefslogtreecommitdiff
path: root/src/lib/writer.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-05-08 01:53:50 +0200
committerCarl Hetherington <cth@carlh.net>2024-05-08 01:53:50 +0200
commit6b2119dcd16c43fd681feace00d4e10f464bb9b7 (patch)
tree50ac586ce4aac6d85c98084ddccd47d4c61ed315 /src/lib/writer.cc
parent29f773b4871511a686054bfcd4d769c3707907f6 (diff)
parent32d04ddb5c583938f470ed74bda8a50cc2ec9960 (diff)
Merge remote-tracking branch 'origin/main' into v2.17.x
Diffstat (limited to 'src/lib/writer.cc')
-rw-r--r--src/lib/writer.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/writer.cc b/src/lib/writer.cc
index 3dd22718f..c0b083ff0 100644
--- a/src/lib/writer.cc
+++ b/src/lib/writer.cc
@@ -146,6 +146,10 @@ Writer::write (shared_ptr<const Data> encoded, Frame frame, Eyes eyes)
{
boost::mutex::scoped_lock lock (_state_mutex);
+ if (_zombie) {
+ return;
+ }
+
while (_queued_full_in_memory > _maximum_frames_in_memory) {
/* There are too many full frames in memory; wake the main writer thread and
wait until it sorts everything out */
@@ -382,6 +386,9 @@ try
while (true)
{
boost::mutex::scoped_lock lock (_state_mutex);
+ if (_zombie) {
+ return;
+ }
while (true) {
@@ -1047,3 +1054,17 @@ Writer::write_hanging_text (ReelWriter& reel)
}
_hanging_texts = new_hanging_texts;
}
+
+
+/** Set the writer so that it has no queue and drops any pending or future requests to write images */
+void
+Writer::zombify()
+{
+ boost::mutex::scoped_lock lock(_state_mutex);
+
+ _queue.clear();
+ _queued_full_in_memory = 0;
+ _zombie = true;
+ _full_condition.notify_all();
+}
+