sd-event: split out helper functions for reshuffling prioqs
authorMichal Sekletár <msekleta@redhat.com>
Fri, 23 Oct 2020 16:29:27 +0000 (18:29 +0200)
committerThe Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>
Wed, 10 Mar 2021 11:41:30 +0000 (12:41 +0100)
commit4ce10f8e41a85a56ad9b805442eb1149ece7c82a
treefb529d5f3b61a8fc1a25709e7b8e8e9fc49142bf
parentee8f1b215fb665b8b9dab7ee29324fdc12ab4b00
sd-event: split out helper functions for reshuffling prioqs

We typically don't just reshuffle a single prioq at once, but always
two. Let's add two helper functions that do this, and reuse them
everywhere.

(Note that this drops one minor optimization:
sd_event_source_set_time_accuracy() previously only reshuffled the
"latest" prioq, since changing the accuracy has no effect on the
earliest time of an event source, just the latest time an event source
can run. This optimization is removed to simplify things, given that
it's not really worth the effort as prioq_reshuffle() on properly
ordered prioqs has practically zero cost O(1)).

(Slightly generalized, commented and split out of #17284 by Lennart)

(cherry picked from commit e1951c16a8fbe5b0b9ecc08f4f835a806059d28f)

Related: #1819868
src/libsystemd/sd-event/sd-event.c