diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-11-20 18:07:07 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-11-20 20:58:17 +0100 |
commit | 2576a19ed25dff1adc7fd2c0b874c74946fb35b4 (patch) | |
tree | 99af8319244dc831c86fb7179eb48a2aab2946d9 /src/libsystemd-bus | |
parent | 503f39c35e0fd7ba23649ec14044e195594e3347 (diff) |
event: whenever a time source changes pending state reshuffle elapsation prioqs
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r-- | src/libsystemd-bus/sd-event.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c index 55a8546089..ec18af43d5 100644 --- a/src/libsystemd-bus/sd-event.c +++ b/src/libsystemd-bus/sd-event.c @@ -543,6 +543,14 @@ static int source_set_pending(sd_event_source *s, bool b) { } else assert_se(prioq_remove(s->event->pending, s, &s->pending_index)); + if (s->type == SOURCE_REALTIME) { + prioq_reshuffle(s->event->realtime_earliest, s, &s->time.earliest_index); + prioq_reshuffle(s->event->realtime_latest, s, &s->time.latest_index); + } else if (s->type == SOURCE_MONOTONIC) { + prioq_reshuffle(s->event->monotonic_earliest, s, &s->time.earliest_index); + prioq_reshuffle(s->event->monotonic_latest, s, &s->time.latest_index); + } + return 0; } @@ -1238,10 +1246,8 @@ _public_ int sd_event_source_set_time(sd_event_source *s, uint64_t usec) { assert_return(s->event->state != SD_EVENT_FINISHED, -ESTALE); assert_return(!event_pid_changed(s->event), -ECHILD); - if (s->time.next == usec) - return 0; - s->time.next = usec; + source_set_pending(s, false); if (s->type == SOURCE_REALTIME) { @@ -1275,11 +1281,10 @@ _public_ int sd_event_source_set_time_accuracy(sd_event_source *s, uint64_t usec if (usec == 0) usec = DEFAULT_ACCURACY_USEC; - if (s->time.accuracy == usec) - return 0; - s->time.accuracy = usec; + source_set_pending(s, false); + if (s->type == SOURCE_REALTIME) prioq_reshuffle(s->event->realtime_latest, s, &s->time.latest_index); else |