Re: [libgpiod] - fast writing while waiting for edge events

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

 



On Wed, Dec 13, 2023 at 01:52:47PM +0100, Mathias Dobler wrote:
> > Firstly note that you cannot lose edge events. They are queued in the
> > kernel in case userspace is a bit busy.  It is still possible to overflow
> > the queue, but it takes serious effort.  You can check the seqnos in the
> > events to detect an overflow.
>
> I think the only thing that is lost is my memory sometimes.
>
> > It is also a bit odd to be monitoring a line for edges AND polling it
> > at the same time.  You get edge events when it changes value, so polling
> > between edges is redundant.
>
> Yeah, I might have to rethink my usage there...
>
> > Though if you are using a libgpiod function to perform the wait you are
> > still stuck, as going by the documentation you have to prevent other
> > access while you are waiting....
>
> > So you have to not use a libgpiod function and wait by poll()ing the
> > request fd.
> > At that point you may as well wait on both requests in the one thread.
> > And then you don't need the mutex as you only have one thread accessing the
> > requests.
>
> I see. So that means waiting on the request fd is not affected by the
> threading contract?

That might technically be a breach of contract, but the fd is
immutable for the lifetime of the request, and I don't see how
that could possibly change, so it is pretty safe.

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