210 lines
6.0 KiB
HTML
210 lines
6.0 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SD_EVENT_RUN</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SD_EVENT_RUN</H1>
|
|
Section: sd_event_run (3)<BR>Updated: <BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
sd_event_run, sd_event_loop - Run an event loop
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<B>
|
|
</B><PRE>
|
|
#include <<A HREF="file:///usr/include/systemd/sd-event.h">systemd/sd-event.h</A>>
|
|
</PRE>
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">
|
|
<B>int sd_event_run(sd_event *</B><I>event</I><B>, uint64_t </B><I>usec</I><B>);</B>
|
|
|
|
<DT id="2">
|
|
<B>int sd_event_loop(sd_event *</B><I>event</I><B>);</B>
|
|
|
|
</DL>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
<B>sd_event_run()</B>
|
|
<DD>may be used to run a single iteration of the event loop specified in the
|
|
<I>event</I>
|
|
parameter. The function waits until an event to process is available, and dispatches the registered handler for it. The
|
|
<I>usec</I>
|
|
parameter specifies the maximum time (in microseconds) to wait for an event. Use
|
|
<B>(uint64_t) -1</B>
|
|
to specify an infinite timeout.
|
|
<P>
|
|
|
|
<B>sd_event_loop()</B>
|
|
invokes
|
|
<B>sd_event_run()</B>
|
|
in a loop, thus implementing the actual event loop. The call returns as soon as exiting was requested using
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_exit">sd_event_exit</A></B>(3).
|
|
<P>
|
|
|
|
The event loop object
|
|
<I>event</I>
|
|
is created with
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_new">sd_event_new</A></B>(3). Events sources to wait for and their handlers may be registered with
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_io">sd_event_add_io</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_time">sd_event_add_time</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_signal">sd_event_add_signal</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_child">sd_event_add_child</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_defer">sd_event_add_defer</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_post">sd_event_add_post</A></B>(3)
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_exit">sd_event_add_exit</A></B>(3).
|
|
<P>
|
|
|
|
For low-level control of event loop execution, use
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_prepare">sd_event_prepare</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_wait">sd_event_wait</A></B>(3)
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_dispatch">sd_event_dispatch</A></B>(3)
|
|
which are wrapped by
|
|
<B>sd_event_run()</B>. Along with
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_get_fd">sd_event_get_fd</A></B>(3), these functions allow integration of an
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd-event">sd-event</A></B>(3)
|
|
event loop into foreign event loop implementations.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
<P>
|
|
|
|
On failure, these functions return a negative errno-style error code.
|
|
<B>sd_event_run()</B>
|
|
returns a positive, non-zero integer if an event source was dispatched, and zero when the specified timeout hit before an event source has seen any event, and hence no event source was dispatched.
|
|
<B>sd_event_loop()</B>
|
|
returns the exit code specified when invoking
|
|
<B>sd_event_exit()</B>.
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Errors</H3>
|
|
|
|
<P>
|
|
|
|
Returned errors may indicate the following problems:
|
|
<P>
|
|
|
|
<B>-EINVAL</B>
|
|
<DL COMPACT><DT id="3"><DD>
|
|
The
|
|
<I>event</I>
|
|
parameter is invalid or
|
|
<B>NULL</B>.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-EBUSY</B>
|
|
<DL COMPACT><DT id="4"><DD>
|
|
The event loop object is not in the right state (see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_prepare">sd_event_prepare</A></B>(3)
|
|
for an explanation of possible states).
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-ESTALE</B>
|
|
<DL COMPACT><DT id="5"><DD>
|
|
The event loop is already terminated.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-ECHILD</B>
|
|
<DL COMPACT><DT id="6"><DD>
|
|
The event loop has been created in a different process.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
Other errors are possible, too.
|
|
<A NAME="lbAG"> </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> <B><A HREF="/cgi-bin/man/man2html?1+pkg-config">pkg-config</A></B>(1)
|
|
file.
|
|
<A NAME="lbAH"> </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-event">sd-event</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_new">sd_event_new</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_io">sd_event_add_io</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_time">sd_event_add_time</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_signal">sd_event_add_signal</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_child">sd_event_add_child</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_inotify">sd_event_add_inotify</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_add_defer">sd_event_add_defer</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_exit">sd_event_exit</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_get_fd">sd_event_get_fd</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sd_event_wait">sd_event_wait</A></B>(3),
|
|
m[blue]<B>GLib Main Event Loop</B>m[]<FONT SIZE="-2">[1]</FONT>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="7"> 1.<DD>
|
|
GLib Main Event Loop
|
|
<DL COMPACT><DT id="8"><DD>
|
|
<A HREF="https://developer.gnome.org/glib/unstable/glib-The-Main-Event-Loop.html">https://developer.gnome.org/glib/unstable/glib-The-Main-Event-Loop.html</A>
|
|
</DL>
|
|
|
|
<P>
|
|
</DL>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="9"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="10"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="11"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="12"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DL>
|
|
<DT id="13"><A HREF="#lbAF">Errors</A><DD>
|
|
</DL>
|
|
<DT id="14"><A HREF="#lbAG">NOTES</A><DD>
|
|
<DT id="15"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
<DT id="16"><A HREF="#lbAI">NOTES</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:55 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|