You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a lot of cases polling a pin for its state is sub optimum, being able to rely on interrupts is kind a convenient way to reduce the latency of change detection and avoid potential bugs. While this is not needed everywhere, I think it would be great to have that in the x/exp/io package.
We need the runtime poller to be exposed first.
As for the API, I'm not so keen on callback based ones, and I think we
should use channels, which ties nicely with other parts of Go. We could
also add a convenience blocking API like "wait for certain level (with
optional debounce) or edge" that mimic our Reader/Writer interfaces (blocks
the goroutine until the event arrives).
In a lot of cases polling a pin for its state is sub optimum, being able to rely on interrupts is kind a convenient way to reduce the latency of change detection and avoid potential bugs. While this is not needed everywhere, I think it would be great to have that in the x/exp/io package.
This approach was implemented in the embd package using the following interface:
https://github.com/kidoman/embd/blob/master/gpio.go#L37
And implementing it on linux using epoll:
https://github.com/kidoman/embd/blob/master/host/generic/interrupt.go
@rakyll how do you feel about supporting such an approach?
The text was updated successfully, but these errors were encountered: