From: Kent Gibson <warthog618@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: [libgpiod v2][PATCH] treewide: allow polling functions to block indefinitely
Date: Fri, 1 Jul 2022 19:52:06 +0800 [thread overview]
Message-ID: <20220701115206.GA42057@sol> (raw)
In-Reply-To: <CAHp75VeG3=uAk6V6MD9soFytrjsDgVnWNK8CodDW+_aY7f5Dug@mail.gmail.com>
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@bgdev.pl> 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.
next prev parent reply other threads:[~2022-07-01 11:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-01 11:00 [libgpiod v2][PATCH] treewide: allow polling functions to block indefinitely Bartosz Golaszewski
2022-07-01 11:10 ` Andy Shevchenko
2022-07-01 11:52 ` Kent Gibson [this message]
2022-07-01 11:52 ` Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220701115206.GA42057@sol \
--to=warthog618@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).