sd_event_source_set_priority() may be used to set the priority for
the event source object specified as source. The priority is
specified as an arbitrary signed 64bit integer. The priority is
initialized to SD_EVENT_PRIORITY_NORMAL (0) when the event source is
allocated with a call such as sd_event_add_io(3) or
sd_event_add_time(3), and may be changed with this call. If multiple
event sources have seen events at the same time, they are dispatched
in the order indicated by the event sources' priorities. Event
sources with smaller priority values are dispatched first. As
well-known points of reference, the constants
SD_EVENT_PRIORITY_IMPORTANT (-100), SD_EVENT_PRIORITY_NORMAL (0) and
SD_EVENT_PRIORITY_IDLE (100) may be used to indicate event sources
that shall be dispatched early, normally or late. It is recommended
to specify priorities based on these definitions, and relative to
them — however, the full 64bit signed integer range is available for
ordering event sources.
Priorities define the order in which event sources that have seen
events are dispatched. Care should be taken to ensure that
high-priority event sources (those with negative priority values
assigned) do not cause starvation of low-priority event sources
(those with positive priority values assigned).
The order in which event sources with the same priority are
dispatched is undefined, but the event loop generally tries to
dispatch them in the order it learnt about events on them. As the
backing kernel primitives do not provide accurate information about
the order in which events occurred this is not necessarily reliable.
However, it is guaranteed that if events are seen on multiple
same-priority event sources at the same time, each one is not
dispatched again until all others have been dispatched once. This
behavior guarantees that within each priority particular event
sources do not starve or dominate the event loop.
sd_event_source_get_priority() may be used to query the current
priority assigned to the event source object source.
Returned errors may indicate the following problems:
-EINVALsource is not a valid pointer to an sd_event_source object.
Not enough memory.
The event loop is already terminated.
The event loop has been created in a different process.
This page is part of the systemd (systemd system and service manager)
project. Information about the project can be found at
⟨http://www.freedesktop.org/wiki/Software/systemd⟩. If you have a bug
report for this manual page, see
page was obtained from the project's upstream Git repository
⟨https://github.com/systemd/systemd.git⟩ on 2017-03-13. If you dis‐
cover any rendering problems in this HTML version of the page, or you
believe there is a better or more up-to-date source for the page, or
you have corrections or improvements to the information in this
COLOPHON (which is not part of the original manual page), send a mail
systemd 233 SD_EVENT_SOURCE_SET_PRIORITY(3)