man-pages/man3/sd_bus_attach_event.3.html
2021-03-31 01:06:50 +01:00

161 lines
4.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SD_BUS_ATTACH_EVENT</TITLE>
</HEAD><BODY>
<H1>SD_BUS_ATTACH_EVENT</H1>
Section: sd_bus_attach_event (3)<BR>Updated: <BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
sd_bus_attach_event, sd_bus_detach_event, sd_bus_get_event - Attach a bus connection object to an event loop
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<B>
</B><PRE>
#include &lt;<A HREF="file:///usr/include/systemd/sd-bus.h">systemd/sd-bus.h</A>&gt;
</PRE>
<DL COMPACT>
<DT id="1">
<B>int sd_bus_attach_event(sd_bus&nbsp;*</B><I>bus</I><B>, sd_event&nbsp;*</B><I>e</I><B>, int&nbsp;</B><I>priority</I><B>);</B>
<DT id="2">
<B>int sd_bus_detach_event(sd_bus&nbsp;*</B><I>bus</I><B>);</B>
<DT id="3">
<B>sd_event *sd_bus_get_event(sd_bus&nbsp;*</B><I>bus</I><B>);</B>
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<B>sd_bus_attach_event()</B>
<DD>attaches the specified bus connection object to an
<B><A HREF="/cgi-bin/man/man2html?3+sd-event">sd-event</A></B>(3)
event loop object at the specified priority (see
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_source_set_priority">sd_event_source_set_priority</A></B>(3)
for details on event loop priorities). When a bus connection object is attached to an event loop incoming messages will be automatically read and processed, and outgoing messages written, whenever the event loop is run. When the event loop is about to terminate, the bus connection is automatically flushed and closed (see
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_set_close_on_exit">sd_bus_set_close_on_exit</A></B>(3)
for details on this). By default bus connection objects are not attached to any event loop. When a bus connection object is attached to one it is not necessary to invoke
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_wait">sd_bus_wait</A></B>(3)
or
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_process">sd_bus_process</A></B>(3)
as this functionality is handled automatically by the event loop.
<P>
<B>sd_bus_detach_event()</B>
detaches a bus object from its event loop.
<P>
The
<B>sd_bus_get_event()</B>
returns the event loop object the specified bus object is currently attached to, or
<B>NULL</B>
if it is currently not attached to any.
<P>
Note that
<B>sd_bus_attach_event()</B>
is only one of three supported ways to implement I/O event handling for bus connections. Alternatively use
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_get_fd">sd_bus_get_fd</A></B>(3)
for hooking up a bus connection object with external or manual event loops. Or use
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_wait">sd_bus_wait</A></B>(3)
as a simple synchronous, blocking I/O waiting call.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
<P>
On success,
<B>sd_bus_attach_event()</B>
and
<B>sd_bus_detach_event()</B>
return 0 or a positive integer. On failure, they return a negative errno-style error code.
<P>
<B>sd_bus_get_event()</B>
returns an event loop object or
<B>NULL</B>.
<A NAME="lbAF">&nbsp;</A>
<H3>Errors</H3>
<P>
Returned errors may indicate the following problems:
<P>
<B>-ECHILD</B>
<DL COMPACT><DT id="4"><DD>
The bus connection has been created in a different process.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>NOTES</H2>
<P>
These APIs are implemented as a shared library, which can be compiled and linked to with the
<B>libsystemd</B>&nbsp;<B><A HREF="/cgi-bin/man/man2html?1+pkg-config">pkg-config</A></B>(1)
file.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?3+sd-bus">sd-bus</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd-event">sd-event</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_source_set_priority">sd_event_source_set_priority</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_set_close_on_exit">sd_bus_set_close_on_exit</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_wait">sd_bus_wait</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+sd_bus_get_fd">sd_bus_get_fd</A></B>(3)
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="5"><A HREF="#lbAB">NAME</A><DD>
<DT id="6"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="7"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="8"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DL>
<DT id="9"><A HREF="#lbAF">Errors</A><DD>
</DL>
<DT id="10"><A HREF="#lbAG">NOTES</A><DD>
<DT id="11"><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:54 GMT, March 31, 2021
</BODY>
</HTML>