1SD_BUS_ATTACH_EVENT(3)        sd_bus_attach_event       SD_BUS_ATTACH_EVENT(3)
2
3
4

NAME

6       sd_bus_attach_event, sd_bus_detach_event, sd_bus_get_event - Attach a
7       bus connection object to an event loop
8

SYNOPSIS

10       #include <systemd/sd-bus.h>
11
12       int sd_bus_attach_event(sd_bus *bus, sd_event *e, int priority);
13
14       int sd_bus_detach_event(sd_bus *bus);
15
16       sd_event *sd_bus_get_event(sd_bus *bus);
17

DESCRIPTION

19       sd_bus_attach_event() attaches the specified bus connection object to
20       an sd-event(3) event loop object at the specified priority (see
21       sd_event_source_set_priority(3) for details on event loop priorities).
22       When a bus connection object is attached to an event loop incoming
23       messages will be automatically read and processed, and outgoing
24       messages written, whenever the event loop is run. When the event loop
25       is about to terminate, the bus connection is automatically flushed and
26       closed (see sd_bus_set_close_on_exit(3) for details on this). By
27       default bus connection objects are not attached to any event loop. When
28       a bus connection object is attached to one it is not necessary to
29       invoke sd_bus_wait(3) or sd_bus_process(3) as this functionality is
30       handled automatically by the event loop.
31
32       sd_bus_detach_event() detaches a bus object from its event loop.
33
34       The sd_bus_get_event() returns the event loop object the specified bus
35       object is currently attached to, or NULL if it is currently not
36       attached to any.
37
38       Note that sd_bus_attach_event() is only one of three supported ways to
39       implement I/O event handling for bus connections. Alternatively use
40       sd_bus_get_fd(3) for hooking up a bus connection object with external
41       or manual event loops. Or use sd_bus_wait(3) as a simple synchronous,
42       blocking I/O waiting call.
43

RETURN VALUE

45       On success, sd_bus_attach_event() and sd_bus_detach_event() return 0 or
46       a positive integer. On failure, they return a negative errno-style
47       error code.
48
49       sd_bus_get_event() returns an event loop object or NULL.
50
51   Errors
52       Returned errors may indicate the following problems:
53
54       -ECHILD
55           The bus connection has been created in a different process.
56

NOTES

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

SEE ALSO

62       systemd(1), sd-bus(3), sd-event(3), sd_event_source_set_priority(3),
63       sd_bus_set_close_on_exit(3), sd_bus_wait(3), sd_bus_get_fd(3)
64
65
66
67systemd 243                                             SD_BUS_ATTACH_EVENT(3)
Impressum