From 6164b01cd8221620de68d3b0041cd3c08f6df52e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 21 Nov 2021 23:35:56 +0100 Subject: Make sure exceptions are re-thrown even if they occur when the queue is full. --- src/lib/j2k_encoder.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc index 70f3c32d4..27eeaa483 100644 --- a/src/lib/j2k_encoder.cc +++ b/src/lib/j2k_encoder.cc @@ -218,13 +218,16 @@ J2KEncoder::encode (shared_ptr pv, DCPTime time) LOG_TIMING ("decoder-sleep queue=%1 threads=%2", _queue.size(), threads); _full_condition.wait (queue_lock); LOG_TIMING ("decoder-wake queue=%1 threads=%2", _queue.size(), threads); + _writer->rethrow (); + /* Re-throw any exception raised by one of our threads. If more + than one has thrown an exception, only one will be rethrown, I think; + but then, if that happens something has gone badly wrong. + */ + rethrow (); } + /* Do it again in case an exception was thrown with an emptier queue */ _writer->rethrow (); - /* Re-throw any exception raised by one of our threads. If more - than one has thrown an exception, only one will be rethrown, I think; - but then, if that happens something has gone badly wrong. - */ rethrow (); auto const position = time.frames_floor(_film->video_frame_rate()); -- cgit v1.2.3