Movatterモバイル変換


[0]ホーム

URL:


man7.org > Linux >man-pages

Linux/UNIX system programming training


sd_event_source_set_priority(3) — Linux manual page

NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |NOTES |HISTORY |SEE ALSO |COLOPHON

SD_EVENT...PRIORITY(3) sd_event_source_set_prioritySD_EVENT...PRIORITY(3)

NAME        top

       sd_event_source_set_priority, sd_event_source_get_priority,       SD_EVENT_PRIORITY_IMPORTANT, SD_EVENT_PRIORITY_NORMAL,       SD_EVENT_PRIORITY_IDLE - Set or retrieve the priority of event       sources

SYNOPSIS        top

#include <systemd/sd-event.h>enum {SD_EVENT_PRIORITY_IMPORTANT= -100,SD_EVENT_PRIORITY_NORMAL= 0,SD_EVENT_PRIORITY_IDLE= 100,       };int sd_event_source_set_priority(sd_event_source *source,int64_tpriority);int sd_event_source_get_priority(sd_event_source *source,int64_t *priority);

DESCRIPTION        top

sd_event_source_set_priority()may be used to set the priority for       the event source object specified assource. The priority is       specified as an arbitrary signed 64-bit integer. The priority is       initialized toSD_EVENT_PRIORITY_NORMAL(0) when the event source       is allocated with a call such assd_event_add_io(3) orsd_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 constantsSD_EVENT_PRIORITY_IMPORTANT(-100),SD_EVENT_PRIORITY_NORMAL(0)       andSD_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 64-bit 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.       The priority of event sources may be changed at any time of their       lifetime, with the exception of inotify event sources (i.e. those       created withsd_event_add_inotify(3)) whose priority may only be       changed in the time between their initial creation and the first       subsequent event loop iteration.sd_event_source_get_priority()may be used to query the current       priority assigned to the event source objectsource.

RETURN VALUE        top

       On success,sd_event_source_set_priority()andsd_event_source_get_priority()return a non-negative integer. On       failure, they return a negative errno-style error code.Errors       Returned errors may indicate the following problems:-EINVALsource is not a valid pointer to an sd_event_source object.-ENOMEM           Not enough memory.-ESTALE           The event loop is already terminated.-ECHILD           The event loop has been created in a different process,           library or module instance.

NOTES        top

       Functions described here are available as a shared library, which       can be compiled against and linked to with thelibsystemd pkg-config(1) file.       The code described here usesgetenv(3), which is declared to be       not multi-thread-safe. This means that the code calling the       functions described here must not callsetenv(3) from a parallel       thread. It is recommended to only do calls tosetenv()from an       early phase of the program when no other threads have been       started.

HISTORY        top

sd_event_source_set_priority()andsd_event_source_get_priority()       were added in version 229.

SEE ALSO        top

sd-event(3),sd_event_add_io(3),sd_event_add_time(3),sd_event_add_signal(3),sd_event_add_child(3),sd_event_add_inotify(3),sd_event_add_defer(3)

COLOPHON        top

       This page is part of thesystemd (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       ⟨http://www.freedesktop.org/wiki/Software/systemd/#bugreports⟩.       This page was obtained from the project's upstream Git repository       ⟨https://github.com/systemd/systemd.git⟩ on 2025-08-11.  (At that       time, the date of the most recent commit that was found in the       repository was 2025-08-11.)  If you discover 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 isnot part of the original manual page), send a mail to       man-pages@man7.orgsystemd 258~rc2SD_EVENT...PRIORITY(3)

Pages that refer to this page:sd_bus_attach_event(3)sd-event(3)sd_event_add_child(3)sd_event_add_defer(3)sd_event_add_inotify(3)sd_event_add_io(3)sd_event_add_time(3)sd_event_source_get_pending(3)sd_event_source_set_floating(3)sd_event_source_set_prepare(3)systemd.directives(7)systemd.index(7)



HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface.

For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere.

Hosting byjambit GmbH.

Cover of TLPI


[8]ページ先頭

©2009-2025 Movatter.jp