On Fri, Jul 01, 2022 at 01:10:12PM +0200, Andy Shevchenko wrote: > On Fri, Jul 1, 2022 at 1:06 PM Bartosz Golaszewski <brgl@xxxxxxxx> wrote: > > > > All polling system calls have some way of being instructed to block > > indefinitely until some event is registered on the file descriptor. > > > > Make both the gpiod_chip_wait_info_event() and > > gpiod_line_request_wait_edge_event() accept negative timeout values in > > which case the underlying ppoll() will block indefinitely. > > Long time no user space done by me, so here my silly question: how to > kill a task that is blocking indefinitely in ppoll()? > Yeah, you don't. In a multi-threaded app you never need to - that thread is dedicated to handling events, and it will keep doing that until the app exits. But if you want to be able to cancel the wait then you add an eventFd, or similar, that you signal to wake the thread to exit. And that is why libgpiod exposes the fd so the user can build their own ppoll should they want to do that. Cheers, Kent.