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 This file is part of elogind.
8 Copyright 2015 Lennart Poettering
10 elogind is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 elogind is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with elogind; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="sd_event_source_get_pending" xmlns:xi="http://www.w3.org/2001/XInclude">
27 <title>sd_event_source_get_pending</title>
28 <productname>elogind</productname>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
41 <refentrytitle>sd_event_source_get_pending</refentrytitle>
42 <manvolnum>3</manvolnum>
46 <refname>sd_event_source_get_pending</refname>
48 <refpurpose>Determine pending state of event sources</refpurpose>
53 <funcsynopsisinfo>#include <elogind/sd-event.h></funcsynopsisinfo>
56 <funcdef>int <function>sd_event_source_get_pending</function></funcdef>
57 <paramdef>sd_event_source *<parameter>source</parameter></paramdef>
64 <title>Description</title>
66 <para><function>sd_event_source_get_pending()</function> may be
67 used to determine whether the event source object specified as
68 <parameter>source</parameter> has seen events but has not been
69 dispatched yet (and thus is marked "pending").</para>
71 <para>Event source objects initially are not marked pending, when
72 they are created with calls such as
73 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
74 <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
75 with the exception of those created with
76 <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>
77 which are immediately marked pending, and
78 <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>
79 for which the "pending" concept is not defined. For details see
80 the respective manual pages.</para>
82 <para>In each event loop iteration one event source of those
83 marked pending is dispatched, in the order defined by the event
84 source priority, as set with
85 <citerefentry><refentrytitle>sd_event_source_set_priority</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
87 <para>For I/O event sources, as created with
88 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
90 <citerefentry><refentrytitle>sd_event_source_get_io_revents</refentrytitle><manvolnum>3</manvolnum></citerefentry>
91 may be used to query the type of event pending in more
97 <title>Return Value</title>
100 <function>sd_event_source_get_pending()</function> returns an
101 integer greater than zero when the event source is marked pending,
102 and zero when the event source is not marked pending. On failure,
103 it returns a negative errno-style error code.</para>
107 <title>Errors</title>
109 <para>Returned errors may indicate the following problems:</para>
113 <term><constant>-EINVAL</constant></term>
115 <listitem><para><parameter>source</parameter> is not a valid
116 pointer to an <structname>sd_event_source</structname>
117 object.</para></listitem>
121 <term><constant>-EDOM</constant></term>
123 <listitem><para><parameter>source</parameter> refers to an
124 event source object created with
125 <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
129 <term><constant>-ENOMEM</constant></term>
131 <listitem><para>Not enough memory.</para></listitem>
135 <term><constant>-ESTALE</constant></term>
137 <listitem><para>The event loop is already terminated.</para></listitem>
142 <term><constant>-ECHILD</constant></term>
144 <listitem><para>The event loop has been created in a different process.</para></listitem>
151 <xi:include href="libelogind-pkgconfig.xml" />
154 <title>See Also</title>
157 <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
158 <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
159 <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
160 <citerefentry><refentrytitle>sd_event_add_child</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
161 <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
162 <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
163 <citerefentry><refentrytitle>sd_event_source_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>