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+
9 <refentry id="sd_event_source_get_pending" xmlns:xi="http://www.w3.org/2001/XInclude">
12 <title>sd_event_source_get_pending</title>
13 <productname>elogind</productname>
17 <contrib>Developer</contrib>
18 <firstname>Lennart</firstname>
19 <surname>Poettering</surname>
20 <email>lennart@poettering.net</email>
26 <refentrytitle>sd_event_source_get_pending</refentrytitle>
27 <manvolnum>3</manvolnum>
31 <refname>sd_event_source_get_pending</refname>
33 <refpurpose>Determine pending state of event sources</refpurpose>
38 <funcsynopsisinfo>#include <elogind/sd-event.h></funcsynopsisinfo>
41 <funcdef>int <function>sd_event_source_get_pending</function></funcdef>
42 <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
49 <title>Description</title>
51 <para><function>sd_event_source_get_pending()</function> may be
52 used to determine whether the event source object specified as
53 <parameter>source</parameter> has seen events but has not been
54 dispatched yet (and thus is marked "pending").</para>
56 <para>Event source objects initially are not marked pending, when
57 they are created with calls such as
58 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
59 <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
60 with the exception of those created with
61 <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>
62 which are immediately marked pending, and
63 <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
64 for which the "pending" concept is not defined. For details see
65 the respective manual pages.</para>
67 <para>In each event loop iteration one event source of those
68 marked pending is dispatched, in the order defined by the event
69 source priority, as set with
70 <citerefentry><refentrytitle>sd_event_source_set_priority</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
72 <para>For I/O event sources, as created with
73 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
75 <citerefentry><refentrytitle>sd_event_source_get_io_revents</refentrytitle><manvolnum>3</manvolnum></citerefentry>
76 may be used to query the type of event pending in more
82 <title>Return Value</title>
85 <function>sd_event_source_get_pending()</function> returns an
86 integer greater than zero when the event source is marked pending,
87 and zero when the event source is not marked pending. On failure,
88 it returns a negative errno-style error code.</para>
94 <para>Returned errors may indicate the following problems:</para>
98 <term><constant>-EINVAL</constant></term>
100 <listitem><para><parameter>source</parameter> is not a valid
101 pointer to an <structname>sd_event_source</structname>
102 object.</para></listitem>
106 <term><constant>-EDOM</constant></term>
108 <listitem><para><parameter>source</parameter> refers to an
109 event source object created with
110 <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
114 <term><constant>-ENOMEM</constant></term>
116 <listitem><para>Not enough memory.</para></listitem>
120 <term><constant>-ESTALE</constant></term>
122 <listitem><para>The event loop is already terminated.</para></listitem>
127 <term><constant>-ECHILD</constant></term>
129 <listitem><para>The event loop has been created in a different process.</para></listitem>
136 <xi:include href="libelogind-pkgconfig.xml" />
139 <title>See Also</title>
142 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
143 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
144 <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
145 <citerefentry><refentrytitle>sd_event_add_child</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
146 <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
147 <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
148 <citerefentry><refentrytitle>sd_event_source_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>