linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
To: linux-gpio@vger.kernel.org
Subject: [libgpiod] Python bindings don't allow to wait on events indefinitely
Date: Thu, 11 May 2023 22:28:34 +0200	[thread overview]
Message-ID: <3545766.4eto28bQOc@archbook> (raw)

Hello,

in libgpiod 1.6.x, Line.event_wait's codepath had no path where ts
as passed to ppoll could ever be NULL. This means waiting indefinitely
was impossible.

I thought hey, maybe the new Python bindings in libgpiod 2.x fixed this,
but no, it has made it worse by explicitly setting timeout to 0 seconds
if it's None[1]. Obviously, this behaviour can't be changed now, because
people depend on this API to return immediately now with None as the
parameter, and changing it to wait indefinitely would no doubt break
actual programs.

So I'm left wondering if there's a particular reason users of these
bindings shouldn't wait on events indefinitely or if that same mistake
was just made twice in a row.

Is there some way the API could be enhanced to support waiting for
events indefinitely without having to slap a While True with
an arbitrarily high timeout around every single invocation?

Regards,
Nicolas Frattaroli

[1]: https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/bindings/python/gpiod/internal.py#n11



             reply	other threads:[~2023-05-11 20:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11 20:28 Nicolas Frattaroli [this message]
2023-05-19  5:17 ` [libgpiod] Python bindings don't allow to wait on events indefinitely Kent Gibson
2023-05-19 14:32   ` Nicolas Frattaroli
2023-05-19 14:56     ` Kent Gibson
2023-05-23 10:03       ` Bartosz Golaszewski
2023-05-23 10:15         ` Kent Gibson
2023-05-23 12:31           ` Bartosz Golaszewski
2023-05-23 13:20             ` Kent Gibson

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=3545766.4eto28bQOc@archbook \
    --to=frattaroli.nicolas@gmail.com \
    --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).