ev_eloop_run() runs the eloop for a given fixed time. If the dispatcher
returns and the timeout isn't reached, then the dispatcher is called
again.
This also adds the *_exit() function which allows to exit the main-loop
and can be called from anywhere (including the callbacks).
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
If a handler does not correctly remove itself on HUP, the epoll-loop will
never sleep again because the fd will always be notified as HUP.
Therefore, remove the fd from the epoll-set directly on HUP. This doesn't
change application behavior so it is safe here.
This also allows other subsystems to ignore HUP/ERR events if they are not
fatal. The FD won't be readded but that may not bother.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This allows to add one eloop object into another eloop. This is useful if
we want to run a single event source isolated (for instance VT on exit).
The internal epoll-descriptor allows polling so this is a fairly
straightforward implementation.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Add support for dispatching events every given interval. timerfd is used
for hooking up to the event loop, similar to how signalfd is used.
Only relative, monotonic and possibly repeating timer events are
supported. It can be enhanced if there's ever a need.
Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
log_warn is much shorter and we already use log_err instead of log_error
so this is more consistent now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
These dispatch debug messages are currently no longer needed and just
fill the log needlessly.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Idle events are dispatched everytime kmscon_eloop_dispatch() is called. To allow
the callbacks to add/remove/modify all current idle events (including themself),
we need to keep a pointer to the currently dispatched event.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>