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 <refentrytitle>sd_event_source_get_pending</refentrytitle>
18 <manvolnum>3</manvolnum>
22 <refname>sd_event_source_get_pending</refname>
24 <refpurpose>Determine pending state of event sources</refpurpose>
29 <funcsynopsisinfo>#include <elogind/sd-event.h></funcsynopsisinfo>
32 <funcdef>int <function>sd_event_source_get_pending</function></funcdef>
33 <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
40 <title>Description</title>
42 <para><function>sd_event_source_get_pending()</function> may be
43 used to determine whether the event source object specified as
44 <parameter>source</parameter> has seen events but has not been
45 dispatched yet (and thus is marked "pending").</para>
47 <para>Event source objects initially are not marked pending, when
48 they are created with calls such as
49 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
50 <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
51 with the exception of those created with
52 <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>
53 which are immediately marked pending, and
54 <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
55 for which the "pending" concept is not defined. For details see
56 the respective manual pages.</para>
58 <para>In each event loop iteration one event source of those
59 marked pending is dispatched, in the order defined by the event
60 source priority, as set with
61 <citerefentry><refentrytitle>sd_event_source_set_priority</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
63 <para>For I/O event sources, as created with
64 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
66 <citerefentry><refentrytitle>sd_event_source_get_io_revents</refentrytitle><manvolnum>3</manvolnum></citerefentry>
67 may be used to query the type of event pending in more
73 <title>Return Value</title>
76 <function>sd_event_source_get_pending()</function> returns an
77 integer greater than zero when the event source is marked pending,
78 and zero when the event source is not marked pending. On failure,
79 it returns a negative errno-style error code.</para>
85 <para>Returned errors may indicate the following problems:</para>
89 <term><constant>-EINVAL</constant></term>
91 <listitem><para><parameter>source</parameter> is not a valid
92 pointer to an <structname>sd_event_source</structname>
93 object.</para></listitem>
97 <term><constant>-EDOM</constant></term>
99 <listitem><para><parameter>source</parameter> refers to an
100 event source object created with
101 <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
105 <term><constant>-ENOMEM</constant></term>
107 <listitem><para>Not enough memory.</para></listitem>
111 <term><constant>-ESTALE</constant></term>
113 <listitem><para>The event loop is already terminated.</para></listitem>
118 <term><constant>-ECHILD</constant></term>
120 <listitem><para>The event loop has been created in a different process.</para></listitem>
127 <xi:include href="libelogind-pkgconfig.xml" />
130 <title>See Also</title>
133 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
134 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
135 <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
136 <citerefentry><refentrytitle>sd_event_add_child</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
137 <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
138 <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
139 <citerefentry><refentrytitle>sd_event_source_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>