Create a GLib.Source that will be dispatched upon delivery of the UNIX
signal signum. In GLib versions before 2.36, only SIGHUP, SIGINT,
SIGTERM can be monitored. In GLib 2.36, SIGUSR1 and SIGUSR2
were added. In GLib 2.54, SIGWINCH was added.
Note that unlike the UNIX default, all sources which have created a
watch will be dispatched, regardless of which underlying thread
invoked g_unix_signal_source_new().
For example, an effective use of this function is to handle SIGTERM
cleanly; flushing any outstanding files, and then calling
g_main_loop_quit(). It is not safe to do any of this from a regular
UNIX signal handler; such a handler may be invoked while malloc() or
another library function is running, causing reentrancy issues if the
handler attempts to use those functions. None of the GLib/GObject
API is safe against this kind of reentrancy.
The interaction of this source when combined with native UNIX
functions like sigprocmask() is not defined.
The source will not initially be associated with any GLib.MainContext
and must be added to one with g_source_attach() before it will be
executed.
Create a GLib.Source that will be dispatched upon delivery of the UNIX signal
signum. In GLib versions before 2.36, onlySIGHUP,SIGINT,SIGTERMcan be monitored. In GLib 2.36,SIGUSR1andSIGUSR2were added. In GLib 2.54,SIGWINCHwas added.Note that unlike the UNIX default, all sources which have created a watch will be dispatched, regardless of which underlying thread invoked
g_unix_signal_source_new().For example, an effective use of this function is to handle
SIGTERMcleanly; flushing any outstanding files, and then callingg_main_loop_quit(). It is not safe to do any of this from a regular UNIX signal handler; such a handler may be invoked whilemalloc()or another library function is running, causing reentrancy issues if the handler attempts to use those functions. None of the GLib/GObject API is safe against this kind of reentrancy.The interaction of this source when combined with native UNIX functions like
sigprocmask()is not defined.The source will not initially be associated with any GLib.MainContext and must be added to one with
g_source_attach()before it will be executed.