Debian Codegraph @

upstream/debian-unstable/man3/sd_event_source_get_pending.3

raw
1 '\" t
2 .TH "SD_EVENT_SOURCE_GET_PENDING" "3" "" "systemd 261~rc3" "sd_event_source_get_pending"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 sd_event_source_get_pending \- Determine pending state of event sources
24 .SH "SYNOPSIS"
25 .sp
26 .ft B
27 .nf
28 #include <systemd/sd\-event\&.h>
29 .fi
30 .ft
31 .HP \w'int\ sd_event_source_get_pending('u
32 .BI "int sd_event_source_get_pending(sd_event_source\ *" "source" ");"
33 .SH "DESCRIPTION"
34 .PP
35 \fBsd_event_source_get_pending()\fR
36 may be used to determine whether the event source object specified as
37 \fIsource\fR
38 has seen events but has not been dispatched yet (and thus is marked "pending")\&.
39 .PP
40 Event source objects initially are not marked pending, when they are created with calls such as
41 \fBsd_event_add_io\fR(3),
42 \fBsd_event_add_time\fR(3), with the exception of those created with
43 \fBsd_event_add_defer\fR(3)
44 which are immediately marked pending, and
45 \fBsd_event_add_exit\fR(3)
46 for which the "pending" concept is not defined\&. For details see the respective manual pages\&.
47 .PP
48 In each event loop iteration one event source of those marked pending is dispatched, in the order defined by the event source priority, as set with
49 \fBsd_event_source_set_priority\fR(3)\&.
50 .PP
51 For I/O event sources, as created with
52 \fBsd_event_add_io\fR(3), the call
53 \fBsd_event_source_get_io_revents\fR(3)
54 may be used to query the type of event pending in more detail\&.
55 .SH "RETURN VALUE"
56 .PP
57 On success,
58 \fBsd_event_source_get_pending()\fR
59 returns an integer greater than zero when the event source is marked pending, and zero when the event source is not marked pending\&. On failure, it returns a negative errno\-style error code\&.
60 .SS "Errors"
61 .PP
62 Returned errors may indicate the following problems:
63 .PP
64 \fB\-EINVAL\fR
65 .RS 4
66 \fIsource\fR
67 is not a valid pointer to an
68 sd_event_source
69 object\&.
70 .RE
71 .PP
72 \fB\-EDOM\fR
73 .RS 4
74 \fIsource\fR
75 refers to an event source object created with
76 \fBsd_event_add_exit\fR(3)\&.
77 .RE
78 .PP
79 \fB\-ENOMEM\fR
80 .RS 4
81 Not enough memory\&.
82 .RE
83 .PP
84 \fB\-ESTALE\fR
85 .RS 4
86 The event loop is already terminated\&.
87 .RE
88 .PP
89 \fB\-ECHILD\fR
90 .RS 4
91 The event loop has been created in a different process, library or module instance\&.
92 .RE
93 .SH "NOTES"
94 .PP
95 Functions described here are available as a shared library, which can be compiled against and linked to with the
96 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
97 file\&.
98 .PP
99 The code described here uses
100 \fBgetenv\fR(3), which is declared to be not multi\-thread\-safe\&. This means that the code calling the functions described here must not call
101 \fBsetenv\fR(3)
102 from a parallel thread\&. It is recommended to only do calls to
103 \fBsetenv()\fR
104 from an early phase of the program when no other threads have been started\&.
105 .SH "HISTORY"
106 .PP
107 \fBsd_event_source_get_pending()\fR
108 was added in version 229\&.
109 .SH "SEE ALSO"
110 .PP
111 \fBsd-event\fR(3), \fBsd_event_add_io\fR(3), \fBsd_event_add_time\fR(3), \fBsd_event_add_signal\fR(3), \fBsd_event_add_child\fR(3), \fBsd_event_add_inotify\fR(3), \fBsd_event_add_defer\fR(3), \fBsd_event_source_unref\fR(3)