mirror of
https://git.proxmox.com/git/systemd
synced 2026-02-01 18:56:05 +00:00
127 lines
3.6 KiB
Groff
127 lines
3.6 KiB
Groff
'\" t
|
|
.TH "SD_EVENT_RUN" "3" "" "systemd 220" "sd_event_run"
|
|
.\" -----------------------------------------------------------------
|
|
.\" * Define some portability stuff
|
|
.\" -----------------------------------------------------------------
|
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
.\" http://bugs.debian.org/507673
|
|
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
.ie \n(.g .ds Aq \(aq
|
|
.el .ds Aq '
|
|
.\" -----------------------------------------------------------------
|
|
.\" * set default formatting
|
|
.\" -----------------------------------------------------------------
|
|
.\" disable hyphenation
|
|
.nh
|
|
.\" disable justification (adjust text to left margin only)
|
|
.ad l
|
|
.\" -----------------------------------------------------------------
|
|
.\" * MAIN CONTENT STARTS HERE *
|
|
.\" -----------------------------------------------------------------
|
|
.SH "NAME"
|
|
sd_event_run, sd_event_loop \- Run libsystemd event loop
|
|
.SH "SYNOPSIS"
|
|
.sp
|
|
.ft B
|
|
.nf
|
|
#include <systemd/sd\-event\&.h>
|
|
.fi
|
|
.ft
|
|
.HP \w'int\ sd_event_run('u
|
|
.BI "int sd_event_run(sd_event\ *" "event" ", uint64_t\ " "timeout" ");"
|
|
.HP \w'int\ sd_event_loop('u
|
|
.BI "int sd_event_loop(sd_event\ *" "event" ");"
|
|
.SH "DESCRIPTION"
|
|
.PP
|
|
\fBsd_event_run()\fR
|
|
can be used to run one iteration of the event loop of libsystemd\&. This function waits until an event to process is available and dispatches a handler for it\&. Parameter
|
|
\fItimeout\fR
|
|
specifices the maximum time (in microseconds) to wait\&.
|
|
\fB(uint64_t) \-1\fR
|
|
may be used to specify an infinite timeout\&.
|
|
.PP
|
|
\fBsd_event_loop\fR
|
|
runs
|
|
\fBsd_event_wait\fR
|
|
in a loop with a timeout of infinity\&. This makes it suitable for the main event loop of a program\&.
|
|
.PP
|
|
The event loop object
|
|
\fIevent\fR
|
|
is created with
|
|
\fBsd_event_new\fR\&. Events to wait for and their handlers can be registered with
|
|
\fBsd_event_add_time\fR,
|
|
\fBsd_event_add_child\fR,
|
|
\fBsd_event_add_signal\fR,
|
|
\fBsd_event_add_defer\fR,
|
|
\fBsd_event_add_exit\fR, and
|
|
\fBsd_event_add_post\fR\&.
|
|
.PP
|
|
For more fine\-grained control,
|
|
\fBsd_event_prepare\fR,
|
|
\fBsd_event_wait\fR, and
|
|
\fBsd_event_dispatch\fR
|
|
may be used\&. Along with
|
|
\fBsd_event_get_fd\fR, those functions make it possible to integrate the libsystemd loop inside of another event loop\&.
|
|
.SH "RETURN VALUE"
|
|
.PP
|
|
On success, these functions return 0 or a positive integer\&. On failure, they return a negative errno\-style error code\&.
|
|
\fBsd_event_run\fR
|
|
returns 0 if the event loop is finished, and a positive value if it can be continued\&.
|
|
.SH "ERRORS"
|
|
.PP
|
|
Returned errors may indicate the following problems:
|
|
.PP
|
|
\fB\-EINVAL\fR
|
|
.RS 4
|
|
Parameter
|
|
\fIevent\fR
|
|
is
|
|
\fBNULL\fR\&.
|
|
.RE
|
|
.PP
|
|
\fB\-EBUSY\fR
|
|
.RS 4
|
|
The event loop object is not in the right state (see
|
|
\fBsd_event_prepare\fR(3)
|
|
for an explanation of possible states)\&.
|
|
.RE
|
|
.PP
|
|
\fB\-ESTALE\fR
|
|
.RS 4
|
|
The event loop is already terminated\&.
|
|
.RE
|
|
.PP
|
|
\fB\-ECHILD\fR
|
|
.RS 4
|
|
The event loop has been created in a different process\&.
|
|
.RE
|
|
.PP
|
|
Other errors are possible too\&.
|
|
.SH "NOTES"
|
|
.PP
|
|
\fBsd_event_run()\fR
|
|
and
|
|
\fBsd_event_loop()\fR
|
|
are available as a shared library, which can be compiled and linked to with the
|
|
\fBlibsystemd\fR\ \&\fBpkg-config\fR(1)
|
|
file\&.
|
|
.SH "SEE ALSO"
|
|
.PP
|
|
\fBsystemd\fR(1),
|
|
\fBsd_event_new\fR(3),
|
|
\fBsd_event_wait\fR(3),
|
|
\fBsd_event_add_io\fR(3),
|
|
\fBsd_event_add_time\fR(3),
|
|
\fBsd_event_add_signal\fR(3),
|
|
\fBsd_event_add_defer\fR(3),
|
|
\fBsd_event_add_exit\fR(3),
|
|
\fBsd_event_add_post\fR(3),
|
|
\m[blue]\fBGLIb Main Event Loop\fR\m[]\&\s-2\u[1]\d\s+2\&.
|
|
.SH "NOTES"
|
|
.IP " 1." 4
|
|
GLIb Main Event Loop
|
|
.RS 4
|
|
\%https://developer.gnome.org/glib/unstable/glib-The-Main-Event-Loop.html
|
|
.RE
|