2 .TH "SD_EVENT_ADD_DEFER" "3" "" "systemd 217" "sd_event_add_defer"
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 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
17 .\" disable justification (adjust text to left margin only)
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
23 sd_event_add_defer, sd_event_add_post, sd_event_add_exit \- Add static event sources to an event loop
28 #include <systemd/sd\-bus\&.h>
31 .HP \w'int\ sd_event_add_defer('u
32 .BI "int sd_event_add_defer(sd_event\ *" "event" ", sd_event_source\ **" "source" ", sd_event_handler_t\ " "handler" ", void\ *" "userdata" ");"
33 .HP \w'int\ sd_event_add_post('u
34 .BI "int sd_event_add_post(sd_event\ *" "event" ", sd_event_source\ **" "source" ", sd_event_handler_t\ " "handler" ", void\ *" "userdata" ");"
35 .HP \w'int\ sd_event_add_exit('u
36 .BI "int sd_event_add_exit(sd_event\ *" "event" ", sd_event_source\ **" "source" ", sd_event_handler_t\ " "handler" ", void\ *" "userdata" ");"
37 .HP \w'typedef\ int\ (*sd_event_handler_t)('u
38 .BI "typedef int (*sd_event_handler_t)(sd_event_source\ *" "s" ", void\ *" "userdata" ");"
41 Those three functions add new event sources to an event loop object\&. The event loop is specified in
42 \fIevent\fR, the event source is returned in the
44 parameter\&. The event sources are enabled statically and will "fire" when the event loop is run and the conditions described below are met\&. The handler function will be passed the
46 pointer, which may be chosen freely by the caller\&.
48 \fBsd_event_add_defer()\fR
49 adds a new event source that will "fire" the next time the event loop is run\&. By default, the handler will be called once (\fBSD_EVENT_ONESHOT\fR)\&.
51 \fBsd_event_add_defer()\fR
52 adds a new event source that will "fire" if any event handlers are invoked whenever the event loop is run\&. By default, the source is enabled permanently (\fBSD_EVENT_ON\fR)\&.
54 \fBsd_event_add_exit()\fR
55 adds a new event source that will "fire" when the event loop is terminated with
56 \fBsd_event_exit()\fR\&.
59 \fBsd_event_source_set_enabled\fR(3)
60 function may be used to enable the event source permanently (\fBSD_EVENT_ON\fR) or to make it fire just once (\fBSD_EVENT_ONESHOT\fR)\&. If the handler function returns a negative error code, it will be disabled after the invocation, even if
65 On success, this functions return 0 or a positive integer\&. On failure, they return a negative errno\-style error code\&.
68 Returned errors may indicate the following problems:
72 Not enough memory to allocate an object\&.
77 An invalid argument has been passed\&.
82 The event loop is already terminated\&.
87 The event loop has been created in a different process\&.
91 Functions described here are available as a shared library, which can be compiled and linked to with the
92 \fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
98 \fBsd_event_new\fR(3),
99 \fBsd_event_add_time\fR(3),
100 \fBsd_event_add_signal\fR(3),
101 \fBsd_event_add_child\fR(3),
102 \fBsd_event_source_set_enabled\fR(3)