From 36bf25371ce77d8cea4336f52e7db09e05f23ca5 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 25 Oct 2012 18:21:59 -0400 Subject: [PATCH] g_unix_signal_source_new: Allow SIGUSR1 and SIGUSR2 These are user defined, it makes sense to allow watching them. This is needed to port gnome-session and gdm over. https://bugzilla.gnome.org/show_bug.cgi?id=686898 --- glib/glib-unix.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/glib/glib-unix.c b/glib/glib-unix.c index 7d2f367..4d933f9 100644 --- a/glib/glib-unix.c +++ b/glib/glib-unix.c @@ -181,11 +181,15 @@ g_unix_set_fd_nonblocking (gint fd, * @signum: A signal number * * Create a #GSource that will be dispatched upon delivery of the UNIX - * signal @signum. Currently only SIGHUP, - * SIGINT, and SIGTERM can - * be monitored. 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(). + * signal @signum. In GLib versions before 2.36, only + * SIGHUP, SIGINT, + * SIGTERM can be monitored. In GLib 2.36, + * SIGUSR1 and SIGUSR2 were + * 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 @@ -209,7 +213,8 @@ g_unix_set_fd_nonblocking (gint fd, GSource * g_unix_signal_source_new (int signum) { - g_return_val_if_fail (signum == SIGHUP || signum == SIGINT || signum == SIGTERM, NULL); + g_return_val_if_fail (signum == SIGHUP || signum == SIGINT || signum == SIGTERM || + signum == SIGUSR1 || signum == SIGUSR2, NULL); return _g_main_create_unix_signal_watch (signum); } -- 2.7.4