Closed Molytho closed 2 years ago
Given the context around the need, I think this would be best done by adding a method to the EventSource
trait that is invoked before the start of a poll cycle.
And probably adjust the error handling to be signaled to the event source as well.
This way the user of an event source doesn't need to manually plumb some source-specific logic.
Sounds good to me but breaks API and is mostly useless to other users of calloop. I thought about it and maybe we could introduce a new trait which provides the interface to the methods and add a method to EventSource
which is called on insertion (which I imagine is more useful to other users) and allows to add an event handling object to the queue. This on the other side is more complex in sense of borrowing and lifetime.
Actually I forgot that the Readiness
struct already contains an error flag, and I don't think epoll
can tell use more than what can already be checked in the callback, so that one is a non-issue.
Adding new methods to EventSource
is not breaking, as long a those methods have a default implementation, which would be simply to do nothing in this case.
WaylandSource of Client-Toolkit needs a way to run code when starting a dispatch cycle (equivalent of idle callbacks) for a proper implementation.
The background can be found here: https://github.com/Smithay/client-toolkit/issues/212