From 157f6a3037b06b68c20efc60de432a9d6d86f70b Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Fri, 2 Mar 2012 16:39:41 +0000 Subject: [PATCH] Task #2669: Fail instead of freeze if the Delay thread terminates prematurely --- RTCP/IONProc/src/Delays.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RTCP/IONProc/src/Delays.cc b/RTCP/IONProc/src/Delays.cc index f61ea3eee24..4ba7a9332f6 100644 --- a/RTCP/IONProc/src/Delays.cc +++ b/RTCP/IONProc/src/Delays.cc @@ -195,6 +195,10 @@ void Delays::mainLoop() bufferUsed.up(itsNrCalcDelays); } } catch (AipsError &ex) { + // trigger getNextDelays and force it to stop + stop = true; + bufferUsed.up(1); + THROW(IONProcException, "AipsError: " << ex.what()); } @@ -210,8 +214,13 @@ void Delays::getNextDelays(Matrix<MVDirection> &directions, Matrix<double> &dela ASSERTSTR(delays.num_elements() == itsNrBeams * (itsMaxNrPencilBeams + 1), delays.num_elements() << " == " << itsNrBeams << "*" << (itsMaxNrPencilBeams + 1)); + ASSERT(itsThread); + bufferUsed.down(); + if (stop) + THROW(IONProcException, "Cannot obtain delays -- delay thread stopped running"); + // copy the directions at itsBuffer[head] into the provided buffer, // and calculate the respective delays for (unsigned b = 0; b < itsNrBeams; b ++) { -- GitLab