]>
Commit | Line | Data |
---|---|---|
dc83f27a LP |
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"> | |
4 | ||
5 | <!-- | |
572eb058 ZJS |
6 | SPDX-License-Identifier: LGPL-2.1+ |
7 | ||
dc83f27a LP |
8 | This file is part of systemd. |
9 | ||
10 | Copyright 2015 Lennart Poettering | |
11 | ||
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. | |
16 | ||
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. | |
21 | ||
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/>. | |
24 | --> | |
25 | ||
26 | <refentry id="sd_event_source_get_pending" xmlns:xi="http://www.w3.org/2001/XInclude"> | |
27 | ||
28 | <refentryinfo> | |
29 | <title>sd_event_source_get_pending</title> | |
30 | <productname>systemd</productname> | |
31 | ||
32 | <authorgroup> | |
33 | <author> | |
34 | <contrib>Developer</contrib> | |
35 | <firstname>Lennart</firstname> | |
36 | <surname>Poettering</surname> | |
37 | <email>lennart@poettering.net</email> | |
38 | </author> | |
39 | </authorgroup> | |
40 | </refentryinfo> | |
41 | ||
42 | <refmeta> | |
43 | <refentrytitle>sd_event_source_get_pending</refentrytitle> | |
44 | <manvolnum>3</manvolnum> | |
45 | </refmeta> | |
46 | ||
47 | <refnamediv> | |
48 | <refname>sd_event_source_get_pending</refname> | |
49 | ||
50 | <refpurpose>Determine pending state of event sources</refpurpose> | |
51 | </refnamediv> | |
52 | ||
53 | <refsynopsisdiv> | |
54 | <funcsynopsis> | |
55 | <funcsynopsisinfo>#include <systemd/sd-event.h></funcsynopsisinfo> | |
56 | ||
57 | <funcprototype> | |
58 | <funcdef>int <function>sd_event_source_get_pending</function></funcdef> | |
59 | <paramdef>sd_event_source *<parameter>source</parameter></paramdef> | |
60 | </funcprototype> | |
61 | ||
62 | </funcsynopsis> | |
63 | </refsynopsisdiv> | |
64 | ||
65 | <refsect1> | |
66 | <title>Description</title> | |
67 | ||
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> | |
72 | ||
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> | |
83 | ||
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> | |
88 | ||
89 | <para>For I/O event sources, as created with | |
90 | <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
91 | the call | |
a3972469 | 92 | <citerefentry><refentrytitle>sd_event_source_get_io_revents</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
dc83f27a LP |
93 | may be used to query the type of event pending in more |
94 | detail.</para> | |
95 | ||
96 | </refsect1> | |
97 | ||
98 | <refsect1> | |
99 | <title>Return Value</title> | |
100 | ||
101 | <para>On success, | |
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> | |
106 | </refsect1> | |
107 | ||
108 | <refsect1> | |
109 | <title>Errors</title> | |
110 | ||
111 | <para>Returned errors may indicate the following problems:</para> | |
112 | ||
113 | <variablelist> | |
114 | <varlistentry> | |
115 | <term><constant>-EINVAL</constant></term> | |
116 | ||
117 | <listitem><para><parameter>source</parameter> is not a valid | |
118 | pointer to an <structname>sd_event_source</structname> | |
119 | object.</para></listitem> | |
120 | </varlistentry> | |
121 | ||
122 | <varlistentry> | |
123 | <term><constant>-EDOM</constant></term> | |
124 | ||
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> | |
128 | </varlistentry> | |
129 | ||
130 | <varlistentry> | |
131 | <term><constant>-ENOMEM</constant></term> | |
132 | ||
133 | <listitem><para>Not enough memory.</para></listitem> | |
134 | </varlistentry> | |
135 | ||
136 | <varlistentry> | |
137 | <term><constant>-ESTALE</constant></term> | |
138 | ||
139 | <listitem><para>The event loop is already terminated.</para></listitem> | |
140 | ||
141 | </varlistentry> | |
142 | ||
143 | <varlistentry> | |
144 | <term><constant>-ECHILD</constant></term> | |
145 | ||
146 | <listitem><para>The event loop has been created in a different process.</para></listitem> | |
147 | ||
148 | </varlistentry> | |
149 | ||
150 | </variablelist> | |
151 | </refsect1> | |
152 | ||
153 | <xi:include href="libsystemd-pkgconfig.xml" /> | |
154 | ||
155 | <refsect1> | |
156 | <title>See Also</title> | |
157 | ||
158 | <para> | |
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> | |
166 | </para> | |
167 | </refsect1> | |
168 | ||
169 | </refentry> |