summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-20 18:20:23 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-20 20:58:17 +0100
commit1b5995b0395fda2c495579a21b73698d1099c487 (patch)
treeb629f036c2ce8b8214d93efc75da2831834c4ffc /src/libsystemd-bus
parentc57b5ca30199cbedaf45a0346c38977387359842 (diff)
event: make sure to possibly disarm the timerfds before we reenter epoll_wait
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/sd-event.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c
index 90cdeda513..2dc3672142 100644
--- a/src/libsystemd-bus/sd-event.c
+++ b/src/libsystemd-bus/sd-event.c
@@ -1756,18 +1756,16 @@ _public_ int sd_event_run(sd_event *e, uint64_t timeout) {
if (r < 0)
goto finish;
- if (event_next_pending(e) || e->need_process_child)
- timeout = 0;
+ r = event_arm_timer(e, e->monotonic_fd, e->monotonic_earliest, e->monotonic_latest, &e->monotonic_next);
+ if (r < 0)
+ goto finish;
- if (timeout > 0) {
- r = event_arm_timer(e, e->monotonic_fd, e->monotonic_earliest, e->monotonic_latest, &e->monotonic_next);
- if (r < 0)
- goto finish;
+ r = event_arm_timer(e, e->realtime_fd, e->realtime_earliest, e->realtime_latest, &e->realtime_next);
+ if (r < 0)
+ goto finish;
- r = event_arm_timer(e, e->realtime_fd, e->realtime_earliest, e->realtime_latest, &e->realtime_next);
- if (r < 0)
- goto finish;
- }
+ if (event_next_pending(e) || e->need_process_child)
+ timeout = 0;
m = epoll_wait(e->epoll_fd, ev_queue, EPOLL_QUEUE_MAX,
timeout == (uint64_t) -1 ? -1 : (int) ((timeout + USEC_PER_MSEC - 1) / USEC_PER_MSEC));