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 This file is part of systemd.
10 Copyright 2015 Lennart Poettering
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 <refentry id=
"sd_event_source_get_pending" xmlns:
xi=
"http://www.w3.org/2001/XInclude">
29 <title>sd_event_source_get_pending
</title>
30 <productname>systemd
</productname>
34 <contrib>Developer
</contrib>
35 <firstname>Lennart
</firstname>
36 <surname>Poettering
</surname>
37 <email>lennart@poettering.net
</email>
43 <refentrytitle>sd_event_source_get_pending
</refentrytitle>
44 <manvolnum>3</manvolnum>
48 <refname>sd_event_source_get_pending
</refname>
50 <refpurpose>Determine pending state of event sources
</refpurpose>
55 <funcsynopsisinfo>#include
<systemd/sd-event.h
></funcsynopsisinfo>
58 <funcdef>int
<function>sd_event_source_get_pending
</function></funcdef>
59 <paramdef>sd_event_source *
<parameter>source
</parameter></paramdef>
66 <title>Description
</title>
68 <para><function>sd_event_source_get_pending()
</function> may be
69 used to determine whether the event source object specified as
70 <parameter>source
</parameter> has seen events but has not been
71 dispatched yet (and thus is marked
"pending").
</para>
73 <para>Event source objects initially are not marked pending, when
74 they are created with calls such as
75 <citerefentry><refentrytitle>sd_event_add_io
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
76 <citerefentry><refentrytitle>sd_event_add_time
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
77 with the exception of those created with
78 <citerefentry><refentrytitle>sd_event_add_defer
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
79 which are immediately marked pending, and
80 <citerefentry><refentrytitle>sd_event_add_exit
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
81 for which the
"pending" concept is not defined. For details see
82 the respective manual pages.
</para>
84 <para>In each event loop iteration one event source of those
85 marked pending is dispatched, in the order defined by the event
86 source priority, as set with
87 <citerefentry><refentrytitle>sd_event_source_set_priority
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
89 <para>For I/O event sources, as created with
90 <citerefentry><refentrytitle>sd_event_add_io
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
92 <citerefentry><refentrytitle>sd_event_source_get_io_revents
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
93 may be used to query the type of event pending in more
99 <title>Return Value
</title>
102 <function>sd_event_source_get_pending()
</function> returns an
103 integer greater than zero when the event source is marked pending,
104 and zero when the event source is not marked pending. On failure,
105 it returns a negative errno-style error code.
</para>
109 <title>Errors
</title>
111 <para>Returned errors may indicate the following problems:
</para>
115 <term><constant>-EINVAL
</constant></term>
117 <listitem><para><parameter>source
</parameter> is not a valid
118 pointer to an
<structname>sd_event_source
</structname>
119 object.
</para></listitem>
123 <term><constant>-EDOM
</constant></term>
125 <listitem><para><parameter>source
</parameter> refers to an
126 event source object created with
127 <citerefentry><refentrytitle>sd_event_add_exit
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para></listitem>
131 <term><constant>-ENOMEM
</constant></term>
133 <listitem><para>Not enough memory.
</para></listitem>
137 <term><constant>-ESTALE
</constant></term>
139 <listitem><para>The event loop is already terminated.
</para></listitem>
144 <term><constant>-ECHILD
</constant></term>
146 <listitem><para>The event loop has been created in a different process.
</para></listitem>
153 <xi:include href=
"libsystemd-pkgconfig.xml" />
156 <title>See Also
</title>
159 <citerefentry><refentrytitle>sd-event
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
160 <citerefentry><refentrytitle>sd_event_add_io
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
161 <citerefentry><refentrytitle>sd_event_add_time
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
162 <citerefentry><refentrytitle>sd_event_add_child
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
163 <citerefentry><refentrytitle>sd_event_add_signal
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
164 <citerefentry><refentrytitle>sd_event_add_defer
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
165 <citerefentry><refentrytitle>sd_event_source_unref
</refentrytitle><manvolnum>3</manvolnum></citerefentry>