<FILE>gunix</FILE>
G_UNIX_ERROR
g_unix_open_pipe
+g_unix_signal_add
+g_unix_signal_add_full
g_unix_signal_source_new
-g_unix_signal_add_watch_full
g_unix_set_fd_nonblocking
<SUBSECTION Private>
}
/**
- * g_unix_signal_add_watch_full:
- * @signum: Signal number
+ * g_unix_signal_add_full:
* @priority: the priority of the signal source. Typically this will be in
* the range between #G_PRIORITY_DEFAULT and #G_PRIORITY_HIGH.
+ * @signum: Signal number
* @handler: Callback
* @user_data: Data for @handler
* @notify: #GDestroyNotify for @handler
* Since: 2.30
*/
guint
-g_unix_signal_add_watch_full (int signum,
- int priority,
- GSourceFunc handler,
- gpointer user_data,
- GDestroyNotify notify)
+g_unix_signal_add_full (int priority,
+ int signum,
+ GSourceFunc handler,
+ gpointer user_data,
+ GDestroyNotify notify)
{
guint id;
GSource *source;
return id;
}
+
+/**
+ * g_unix_signal_add_full:
+ * @signum: Signal number
+ * @handler: Callback
+ * @user_data: Data for @handler
+ *
+ * A convenience function for g_unix_signal_source_new(), which
+ * attaches to the default #GMainContext. You can remove the watch
+ * using g_source_remove().
+ *
+ * Returns: An ID (greater than 0) for the event source
+ *
+ * Since: 2.30
+ */
+guint
+g_unix_signal_add (int signum,
+ GSourceFunc handler,
+ gpointer user_data)
+{
+ return g_unix_signal_add_full (G_PRIORITY_DEFAULT, signum, handler, user_data, NULL);
+}
gboolean nonblock,
GError **error);
-GSource *g_unix_signal_source_new (gint signum);
+GSource *g_unix_signal_source_new (gint signum);
-guint g_unix_signal_add_watch_full (gint signum,
- gint priority,
- GSourceFunc handler,
- gpointer user_data,
- GDestroyNotify notify);
+guint g_unix_signal_add_full (gint priority,
+ gint signum,
+ GSourceFunc handler,
+ gpointer user_data,
+ GDestroyNotify notify);
+
+guint g_unix_signal_add (gint signum,
+ GSourceFunc handler,
+ gpointer user_data);
#endif
g_unix_error_quark
g_unix_open_pipe
g_unix_set_fd_nonblocking
+g_unix_signal_add
+g_unix_signal_add_full
g_unix_signal_source_new
-g_unix_signal_add_watch_full
#endif
g_ascii_table
g_utf8_skip
mainloop = g_main_loop_new (NULL, FALSE);
sig_received = FALSE;
- g_unix_signal_add_watch_full (signum,
- G_PRIORITY_DEFAULT,
- on_sig_received,
- mainloop,
- NULL);
+ g_unix_signal_add (signum, on_sig_received, mainloop);
kill (getpid (), signum);
g_assert (!sig_received);
g_timeout_add (5000, sig_not_received, mainloop);
mainloop = g_main_loop_new (NULL, FALSE);
sig_received = FALSE;
- id = g_unix_signal_add_watch_full (SIGHUP,
- G_PRIORITY_DEFAULT,
- on_sig_received,
- mainloop,
- NULL);
+ id = g_unix_signal_add (SIGHUP, on_sig_received, mainloop);
g_source_remove (id);
kill (getpid (), SIGHUP);
g_assert (!sig_received);