diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-10-02 09:51:36 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-10-07 09:40:16 +0200 |
commit | b9350e70aa050d97c47ff59994e84fa8c3de4738 (patch) | |
tree | 467bb5ba1acd7393c22cab9c002955d560b5a9b3 /man/sd_event_exit.xml | |
parent | bac0bfc1d0ee1e57055dffb78c77a1ee021ce536 (diff) | |
download | systemd-b9350e70aa050d97c47ff59994e84fa8c3de4738.tar.gz |
sd-event: support callback=NULL in IO/child/inotify/defer event sources, too
Also, document this functionality more prominently, including with a
reference from sd_event_exit().
This is mostly to make things complete, as previously we supported NULL
callbacks only in _add_time() and _add_signal(). However, I think this
makes snese for IO event sources too (think: when some fd such as a pipe
end sees SIGHUP or so, exit), as well as defer or post event sources (i.e. exit
once we got nothing else to do). This also adds support for inotify
event sources, simply to complete things (I can't see the immediate use,
but maybe someone else comes up with it).
The only event source type that doesn't allow callback=NULL now are exit
callbacks, but for them they make little sense, as the event loop is
exiting then anyway.
Diffstat (limited to 'man/sd_event_exit.xml')
-rw-r--r-- | man/sd_event_exit.xml | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/man/sd_event_exit.xml b/man/sd_event_exit.xml index a02897af0b..53aed70012 100644 --- a/man/sd_event_exit.xml +++ b/man/sd_event_exit.xml @@ -74,6 +74,16 @@ conflict with regular exit codes returned by <function>sd_event_loop()</function>, if these exit codes shall be distinguishable.</para> + + <para>Note that for most event source types passing the callback pointer as <constant>NULL</constant> in + the respective constructor call (i.e. in + <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + …) has the effect of <function>sd_event_exit()</function> being invoked once the event source triggers, + with the specified userdata pointer cast to an integer as the exit code parameter. This is useful to + automatically terminate an event loop after some condition, such as a time-out or reception of + <constant>SIGTERM</constant> or similar. See the documentation for the respective constructor call for + details.</para> </refsect1> <refsect1> @@ -128,7 +138,12 @@ <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>sd-event</refentrytitle><manvolnum>3</manvolnum></citerefentry>, <citerefentry><refentrytitle>sd_event_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, - <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry> + <citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>sd_event_add_time</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>sd_event_add_io</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>, + <citerefentry><refentrytitle>sd_event_add_inotify</refentrytitle><manvolnum>3</manvolnum></citerefentry> </para> </refsect1> |