1 <?xml version='
1.0'
?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 SPDX-License-Identifier: LGPL-2.1+
8 Copyright 2015 Lennart Poettering
11 <refentry id=
"sd_event_source_get_pending" xmlns:
xi=
"http://www.w3.org/2001/XInclude">
14 <title>sd_event_source_get_pending
</title>
15 <productname>systemd
</productname>
19 <contrib>Developer
</contrib>
20 <firstname>Lennart
</firstname>
21 <surname>Poettering
</surname>
22 <email>lennart@poettering.net
</email>
28 <refentrytitle>sd_event_source_get_pending
</refentrytitle>
29 <manvolnum>3</manvolnum>
33 <refname>sd_event_source_get_pending
</refname>
35 <refpurpose>Determine pending state of event sources
</refpurpose>
40 <funcsynopsisinfo>#include
<systemd/sd-event.h
></funcsynopsisinfo>
43 <funcdef>int
<function>sd_event_source_get_pending
</function></funcdef>
44 <paramdef>sd_event_source *
<parameter>source
</parameter></paramdef>
51 <title>Description
</title>
53 <para><function>sd_event_source_get_pending()
</function> may be
54 used to determine whether the event source object specified as
55 <parameter>source
</parameter> has seen events but has not been
56 dispatched yet (and thus is marked
"pending").
</para>
58 <para>Event source objects initially are not marked pending, when
59 they are created with calls such as
60 <citerefentry><refentrytitle>sd_event_add_io
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
61 <citerefentry><refentrytitle>sd_event_add_time
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
62 with the exception of those created with
63 <citerefentry><refentrytitle>sd_event_add_defer
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
64 which are immediately marked pending, and
65 <citerefentry><refentrytitle>sd_event_add_exit
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
66 for which the
"pending" concept is not defined. For details see
67 the respective manual pages.
</para>
69 <para>In each event loop iteration one event source of those
70 marked pending is dispatched, in the order defined by the event
71 source priority, as set with
72 <citerefentry><refentrytitle>sd_event_source_set_priority
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
74 <para>For I/O event sources, as created with
75 <citerefentry><refentrytitle>sd_event_add_io
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
77 <citerefentry><refentrytitle>sd_event_source_get_io_revents
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
78 may be used to query the type of event pending in more
84 <title>Return Value
</title>
87 <function>sd_event_source_get_pending()
</function> returns an
88 integer greater than zero when the event source is marked pending,
89 and zero when the event source is not marked pending. On failure,
90 it returns a negative errno-style error code.
</para>
96 <para>Returned errors may indicate the following problems:
</para>
100 <term><constant>-EINVAL
</constant></term>
102 <listitem><para><parameter>source
</parameter> is not a valid
103 pointer to an
<structname>sd_event_source
</structname>
104 object.
</para></listitem>
108 <term><constant>-EDOM
</constant></term>
110 <listitem><para><parameter>source
</parameter> refers to an
111 event source object created with
112 <citerefentry><refentrytitle>sd_event_add_exit
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para></listitem>
116 <term><constant>-ENOMEM
</constant></term>
118 <listitem><para>Not enough memory.
</para></listitem>
122 <term><constant>-ESTALE
</constant></term>
124 <listitem><para>The event loop is already terminated.
</para></listitem>
129 <term><constant>-ECHILD
</constant></term>
131 <listitem><para>The event loop has been created in a different process.
</para></listitem>
138 <xi:include href=
"libsystemd-pkgconfig.xml" />
141 <title>See Also
</title>
144 <citerefentry><refentrytitle>sd-event
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
145 <citerefentry><refentrytitle>sd_event_add_io
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
146 <citerefentry><refentrytitle>sd_event_add_time
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
147 <citerefentry><refentrytitle>sd_event_add_child
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
148 <citerefentry><refentrytitle>sd_event_add_signal
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
149 <citerefentry><refentrytitle>sd_event_add_defer
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
150 <citerefentry><refentrytitle>sd_event_source_unref
</refentrytitle><manvolnum>3</manvolnum></citerefentry>