Re: [libgpiod v2][PATCH] treewide: allow polling functions to block indefinitely

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux