X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd-bus%2Fsd-event.c;h=ec18af43d51f385d90ccef2bcaca8cf58bb48c02;hb=2576a19ed25dff1adc7fd2c0b874c74946fb35b4;hp=55a85460893443095f9e6c60386040c5d6fe49e8;hpb=503f39c35e0fd7ba23649ec14044e195594e3347;p=elogind.git diff --git a/src/libsystemd-bus/sd-event.c b/src/libsystemd-bus/sd-event.c index 55a854608..ec18af43d 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