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
13 <refentry id=
"sd_event_source_get_pending" xmlns:
xi=
"http://www.w3.org/2001/XInclude">
16 <title>sd_event_source_get_pending
</title>
17 <productname>systemd
</productname>
21 <contrib>Developer
</contrib>
22 <firstname>Lennart
</firstname>
23 <surname>Poettering
</surname>
24 <email>lennart@poettering.net
</email>
30 <refentrytitle>sd_event_source_get_pending
</refentrytitle>
31 <manvolnum>3</manvolnum>
35 <refname>sd_event_source_get_pending
</refname>
37 <refpurpose>Determine pending state of event sources
</refpurpose>
42 <funcsynopsisinfo>#include
<systemd/sd-event.h
></funcsynopsisinfo>
45 <funcdef>int
<function>sd_event_source_get_pending
</function></funcdef>
46 <paramdef>sd_event_source *
<parameter>source
</parameter></paramdef>
53 <title>Description
</title>
55 <para><function>sd_event_source_get_pending()
</function> may be
56 used to determine whether the event source object specified as
57 <parameter>source
</parameter> has seen events but has not been
58 dispatched yet (and thus is marked
"pending").
</para>
60 <para>Event source objects initially are not marked pending, when
61 they are created with calls such as
62 <citerefentry><refentrytitle>sd_event_add_io
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
63 <citerefentry><refentrytitle>sd_event_add_time
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
64 with the exception of those created with
65 <citerefentry><refentrytitle>sd_event_add_defer
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
66 which are immediately marked pending, and
67 <citerefentry><refentrytitle>sd_event_add_exit
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
68 for which the
"pending" concept is not defined. For details see
69 the respective manual pages.
</para>
71 <para>In each event loop iteration one event source of those
72 marked pending is dispatched, in the order defined by the event
73 source priority, as set with
74 <citerefentry><refentrytitle>sd_event_source_set_priority
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para>
76 <para>For I/O event sources, as created with
77 <citerefentry><refentrytitle>sd_event_add_io
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
79 <citerefentry><refentrytitle>sd_event_source_get_io_revents
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
80 may be used to query the type of event pending in more
86 <title>Return Value
</title>
89 <function>sd_event_source_get_pending()
</function> returns an
90 integer greater than zero when the event source is marked pending,
91 and zero when the event source is not marked pending. On failure,
92 it returns a negative errno-style error code.
</para>
98 <para>Returned errors may indicate the following problems:
</para>
102 <term><constant>-EINVAL
</constant></term>
104 <listitem><para><parameter>source
</parameter> is not a valid
105 pointer to an
<structname>sd_event_source
</structname>
106 object.
</para></listitem>
110 <term><constant>-EDOM
</constant></term>
112 <listitem><para><parameter>source
</parameter> refers to an
113 event source object created with
114 <citerefentry><refentrytitle>sd_event_add_exit
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para></listitem>
118 <term><constant>-ENOMEM
</constant></term>
120 <listitem><para>Not enough memory.
</para></listitem>
124 <term><constant>-ESTALE
</constant></term>
126 <listitem><para>The event loop is already terminated.
</para></listitem>
131 <term><constant>-ECHILD
</constant></term>
133 <listitem><para>The event loop has been created in a different process.
</para></listitem>
140 <xi:include href=
"libsystemd-pkgconfig.xml" />
143 <title>See Also
</title>
146 <citerefentry><refentrytitle>sd-event
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
147 <citerefentry><refentrytitle>sd_event_add_io
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
148 <citerefentry><refentrytitle>sd_event_add_time
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
149 <citerefentry><refentrytitle>sd_event_add_child
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
150 <citerefentry><refentrytitle>sd_event_add_signal
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
151 <citerefentry><refentrytitle>sd_event_add_defer
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
152 <citerefentry><refentrytitle>sd_event_source_unref
</refentrytitle><manvolnum>3</manvolnum></citerefentry>