sd_event_set_signal_exit — Automatically leave event loop on
sd_event_set_signal_exit() may be used to ensure the event loop terminates
SIGTERM signal is received. It is a
convencience wrapper around invocations of
for both signals. The two signals are automatically added to the calling thread's signal mask (if a
program is multi-threaded care should be taken to either invoke this function before the first thread is
started or to manually block the two signals process-wide first).
If the parameter
b is specified as true, the event loop will terminate on
SIGTERM. If specified as false, it will no
longer. When this functionality is turned off the calling thread's signal mask is restored to match the
state before it was turned on, for the two signals. By default the two signals are not handled by the
event loop, and Linux' default signal handling for them is in effect.
It's customary for UNIX programs to exit on either of these two signals, hence it's typically a good idea to enable this functionality for the main event loop of a program.
sd_event_set_signal_exit() returns a positive non-zero value when the setting
was successfully changed. It returns a zero when the specified setting was already in effect. On failure,
it returns a negative errno-style error code.
These APIs are implemented as a shared
library, which can be compiled and linked to with the