1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 01:27:11 +03:00

event: whenever a time source changes pending state reshuffle elapsation prioqs

This commit is contained in:
Lennart Poettering 2013-11-20 18:07:07 +01:00
parent 503f39c35e
commit 2576a19ed2

View File

@ -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