1SD_EVENT_EXIT(3)                 sd_event_exit                SD_EVENT_EXIT(3)
2
3
4

NAME

6       sd_event_exit, sd_event_get_exit_code - Ask the event loop to exit
7

SYNOPSIS

9       #include <systemd/sd-event.h>
10
11       int sd_event_exit(sd_event *event, int code);
12
13       int sd_event_get_exit_code(sd_event *event, int *code);
14

DESCRIPTION

16       sd_event_exit() requests the event loop specified in the event event
17       loop object to exit. The code parameter may be any integer value and is
18       returned as-is by sd_event_loop(3) after the last event loop iteration.
19       It may also be queried using sd_event_get_exit_code(), see below.
20
21       When exiting is requested the event loop will stop listening for and
22       dispatching regular event sources. Instead it will proceed with
23       executing only event sources registered with sd_event_add_exit(3) in
24       the order defined by their priority. After all exit event sources have
25       been dispatched the event loop is terminated.
26
27       If sd_event_exit() is invoked a second time while the event loop is
28       still processing exit event sources, the exit code stored in the event
29       loop object is updated, but otherwise no further operation is executed.
30
31       sd_event_get_exit_code() may be used to query the exit code passed into
32       sd_event_exit() earlier.
33
34       While the full positive and negative integer ranges may be used for the
35       exit code, care should be taken not pick exit codes that conflict with
36       regular exit codes returned by sd_event_loop(), if these exit codes
37       shall be distinguishable.
38

RETURN VALUE

40       On success, sd_event_exit() and sd_event_get_exit_code() return 0 or a
41       positive integer. On failure, they return a negative errno-style error
42       code.
43

ERRORS

45       Returned errors may indicate the following problems:
46
47       -EINVAL
48           The event loop object or error code pointer are invalid.
49
50       -ECHILD
51           The event loop was created in a different process.
52
53       -ESTALE
54           The event loop has exited already and all exit handlers are already
55           processed.
56
57       -ENODATA
58           The event loop has not been requested to exit yet.
59

NOTES

61       These APIs are implemented as a shared library, which can be compiled
62       and linked to with the libsystemd pkg-config(1) file.
63

SEE ALSO

65       systemd(1), sd-event(3), sd_event_new(3), sd_event_add_exit(3)
66
67
68
69systemd 239                                                   SD_EVENT_EXIT(3)
Impressum