diff --git a/RTCP/IONProc/src/Delays.cc b/RTCP/IONProc/src/Delays.cc index f61ea3eee24318a90a04003297c88ce7a9d3d6c2..4ba7a9332f6bda5344464326842036450114da2d 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 ++) {