CtControl::m_img_status_thread_list management is not completely thread-safe
[un]registerImageStatusCallback
hold the lock before modifying the list. Before doing so, the acquisition state must be AcqReady
(unregister) or different that AcqRunning
(register).
During AcqRunning
many methods iterate the list after releasing the lock. This is done for performance reasons. In a first approach there should be no big risk here, because taking/releasing the lock forces memory barriers that avoid race conditions.
There are two places with a risk of code iterating the list in parallel to a call to [un]registerImageStatusCallback
:
- In the beginning of
prepareAcq
, where no lock is taken - At the end of the last call to
_calcAcqStatus
, after setting the state toAcqReady
.
A possible solution: add a m_img_status_thread_list_busy
flag.