Flushing FIFOs
This section describes how to flush the acquisition FIFO using different frame grabbers.
You call ccAcqFifo::flush() to discard all outstanding acquisitions, leaving the FIFO in the idle state. If an acquisition is pending or is in progress, it is cancelled and discarded. Completed acquisitions in the completeAcq() queue are also discarded.
If ccAcqFifo::triggerEnable() is true, flush() disables triggers before discarding all acquisitions, then re-enables triggers.
Because enabling/disabling triggers affects all related masters and slaves, this function can have unpredictable results in a synchronous configuration when triggers are enabled. To avoid hangs and unexpected behavior, follow the steps below when flushing master-slave FIFOs:
- Call triggerEnable(false) on the master FIFO. CVL will forward the call to all slaves.
- Call flush() on all synchronously related FIFOs. The calls to flush can happen simultaneously in separate threads if desired.
- Call triggerEnable(true) on the master FIFO, if desired.
Note that each of the above steps must be completed before proceeding to the next step.
23735
Flushing a FIFO can take anywhere from 0.3 ms to 32 ms to complete. Because a flush halts any acquisitions in progress, CVL waits for the camera to finish reading out the halted image before flushing the FIFO. This ensures that the camera is fully flushed and ready to start a new acquisition. Disabling triggers will take a finite amount of time, as determined by the camera frame time. This affects all functions that call the function to disable triggers.
If you simply want to get rid of stale images, use the code shown below. This code will flush the completed acquisitions (but not pending acquisitions) for a FIFO in less than 100 microseconds per loop without affecting any acquisitions that may be in progress:
while(fifo->isComplete())
fifo->completeAcq(ccAcqFifo::CompleteArgs()
.makeLocal(false));