Abraham vd Merwe wrote:
> Hi!
> 
> 1. user does select() to wait for a frame to be ready.
> 2. select polls until it finds a frame that's done and return POLLIN
> 3. interrupt handler goes and unmark that frame as ready and start capturing
>    a new frame into that same buffer.
> 4. user does VIDIOC_DQBUF ioctl which fails because that buffer is not ready
>    anymore.
> 
> There's no way with the current API to avoid above scenario unless the
> driver already dequeues the buffer in select() and then just confirms it in
> the DQBUF ioctl. (Or if VIDIOC_DQBUF blocked).
> 
> How am I supposed to avoid the race without resorting to the methods
> mentioned above?

This shouldn't be a problem.  The driver isn't supposed to capture 
another image into the buffer until it is queued again.  The buffer 
should have the following states:

1) Unused
2) Waiting to capture
3) Capturing
4) Capture completed
5) Dequeued (go back to 1)

There is no way to go from state 4 back to state 3 withou program 
intervention.  If the driver handles it differently, then there is 
probably a problem with the driver.

-justin





_______________________________________________
Video4linux-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/video4linux-list

Reply via email to