[libcamera-devel] [RFC v1 5/7] py: Add 'nonblocking' argument to get_ready_requests()

Tomi Valkeinen tomi.valkeinen at ideasonboard.com
Thu Jun 30 08:13:15 CEST 2022


On 28/06/2022 11:16, David Plowman wrote:
> Hi everyone
> 
> Sorry for not taking part in this discussion rather more, and thanks
> to those who have! I think I was asked further back if I had an
> opinion, so let me try and explain how I see things.
> 
> Actually I don't have any particularly strong opinions, other than
> that I want things to work and to be easy to use. And if they stopped
> changing, that would be nice too!!
> 
> I was actually OK with the previous version where get_ready_requests
> was non-blocking, it's only the more recent version that causes me
> some trouble because I can't simply flush out any lurking requests
> after stopping the camera - because there might not be any and I will
> simply lock up the system.

Btw, while we're discussing and fixing this issue, you can also do a 
check in Python:

         import selectors
         sel = selectors.DefaultSelector()
         sel.register(cm.event_fd, selectors.EVENT_READ)
         events = sel.select(0)
         if events:
             print("get_ready_requests doesn't block")
         else:
             print("get_ready_requests may block")

This could be used to avoid calling get_ready_requests when it may block.

  Tomi


More information about the libcamera-devel mailing list