Commit 866e8c8c authored by operator for beamline's avatar operator for beamline Committed by Alejandro Homs Puron
Browse files

Buffer: AcqThread does not wait for Lima buffer if stopped

parent 76ad86e5
......@@ -78,7 +78,7 @@ public:
void setAcqBufferCPUAffinity(CPUAffinity buffer_affinity);
void waitLimaFrame(FrameType frame_nb, AutoMutex& l);
bool waitLimaFrame(FrameType frame_nb, AutoMutex& l);
char *getAcqFrameBufferPtr(FrameType frame_nb);
BufferCtrlObj *getBufferCtrlObj()
......
......@@ -43,22 +43,20 @@ void BufferMgr::setLimaBufferCtrlObj(BufferCtrlObj *buffer_ctrl_obj)
buffer_ctrl_obj->getBufferSync(m_cond) : NULL;
}
void BufferMgr::waitLimaFrame(FrameType frame_nb, AutoMutex& l)
bool BufferMgr::waitLimaFrame(FrameType frame_nb, AutoMutex& l)
{
DEB_MEMBER_FUNCT();
if (!m_lima_buffer_ctrl_obj)
THROW_HW_ERROR(Error) << "No Lima BufferCbMgr defined";
while (true) {
BufferSync::Status status = m_lima_buffer_sync->wait(frame_nb);
switch (status) {
case BufferSync::AVAILABLE:
return;
case BufferSync::INTERRUPTED:
continue;
default:
THROW_HW_ERROR(Error) << "Lima buffer sync wait error: "
<< status;
}
BufferSync::Status status = m_lima_buffer_sync->wait(frame_nb);
switch (status) {
case BufferSync::AVAILABLE:
return true;
case BufferSync::INTERRUPTED:
return false;
default:
THROW_HW_ERROR(Error) << "Lima buffer sync wait error: "
<< status;
}
}
......
......@@ -206,7 +206,11 @@ void Camera::AcqThread::threadFunction()
}
if ((frame == -1) || (m_state == StopReq))
break;
m_cam->m_buffer.waitLimaFrame(frame, l);
while (m_state != StopReq)
if (m_cam->m_buffer.waitLimaFrame(frame, l))
break;
if (m_state == StopReq)
break;
{
AutoMutexUnlock u(l);
Status status = newFrameReady(frame);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment