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: ...@@ -78,7 +78,7 @@ public:
void setAcqBufferCPUAffinity(CPUAffinity buffer_affinity); void setAcqBufferCPUAffinity(CPUAffinity buffer_affinity);
void waitLimaFrame(FrameType frame_nb, AutoMutex& l); bool waitLimaFrame(FrameType frame_nb, AutoMutex& l);
char *getAcqFrameBufferPtr(FrameType frame_nb); char *getAcqFrameBufferPtr(FrameType frame_nb);
BufferCtrlObj *getBufferCtrlObj() BufferCtrlObj *getBufferCtrlObj()
......
...@@ -43,22 +43,20 @@ void BufferMgr::setLimaBufferCtrlObj(BufferCtrlObj *buffer_ctrl_obj) ...@@ -43,22 +43,20 @@ void BufferMgr::setLimaBufferCtrlObj(BufferCtrlObj *buffer_ctrl_obj)
buffer_ctrl_obj->getBufferSync(m_cond) : NULL; 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(); DEB_MEMBER_FUNCT();
if (!m_lima_buffer_ctrl_obj) if (!m_lima_buffer_ctrl_obj)
THROW_HW_ERROR(Error) << "No Lima BufferCbMgr defined"; THROW_HW_ERROR(Error) << "No Lima BufferCbMgr defined";
while (true) { BufferSync::Status status = m_lima_buffer_sync->wait(frame_nb);
BufferSync::Status status = m_lima_buffer_sync->wait(frame_nb); switch (status) {
switch (status) { case BufferSync::AVAILABLE:
case BufferSync::AVAILABLE: return true;
return; case BufferSync::INTERRUPTED:
case BufferSync::INTERRUPTED: return false;
continue; default:
default: THROW_HW_ERROR(Error) << "Lima buffer sync wait error: "
THROW_HW_ERROR(Error) << "Lima buffer sync wait error: " << status;
<< status;
}
} }
} }
......
...@@ -206,7 +206,11 @@ void Camera::AcqThread::threadFunction() ...@@ -206,7 +206,11 @@ void Camera::AcqThread::threadFunction()
} }
if ((frame == -1) || (m_state == StopReq)) if ((frame == -1) || (m_state == StopReq))
break; 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); AutoMutexUnlock u(l);
Status status = newFrameReady(frame); Status status = newFrameReady(frame);
......
Supports Markdown
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