+g_child_watch_closure_callback (GPid pid,
+ gint status,
+ gpointer data)
+{
+ GClosure *closure = data;
+
+ GValue params[2] = { G_VALUE_INIT, G_VALUE_INIT };
+ GValue result_value = G_VALUE_INIT;
+ gboolean result;
+
+ g_value_init (&result_value, G_TYPE_BOOLEAN);
+
+#ifdef G_OS_UNIX
+ g_value_init (¶ms[0], G_TYPE_ULONG);
+ g_value_set_ulong (¶ms[0], pid);
+#endif
+#ifdef G_OS_WIN32
+ g_value_init (¶ms[0], G_TYPE_POINTER);
+ g_value_set_pointer (¶ms[0], pid);
+#endif
+
+ g_value_init (¶ms[1], G_TYPE_INT);
+ g_value_set_int (¶ms[1], status);
+
+ g_closure_invoke (closure, &result_value, 2, params, NULL);
+
+ result = g_value_get_boolean (&result_value);
+ g_value_unset (&result_value);
+ g_value_unset (¶ms[0]);
+ g_value_unset (¶ms[1]);
+
+ return result;
+}
+
+#ifdef G_OS_UNIX
+static gboolean
+g_unix_fd_source_closure_callback (int fd,
+ GIOCondition condition,
+ gpointer data)
+{
+ GClosure *closure = data;
+
+ GValue params[2] = { G_VALUE_INIT, G_VALUE_INIT };
+ GValue result_value = G_VALUE_INIT;
+ gboolean result;
+
+ g_value_init (&result_value, G_TYPE_BOOLEAN);
+
+ g_value_init (¶ms[0], G_TYPE_INT);
+ g_value_set_int (¶ms[0], fd);
+
+ g_value_init (¶ms[1], G_TYPE_IO_CONDITION);
+ g_value_set_flags (¶ms[1], condition);
+
+ g_closure_invoke (closure, &result_value, 2, params, NULL);
+
+ result = g_value_get_boolean (&result_value);
+ g_value_unset (&result_value);
+ g_value_unset (¶ms[0]);
+ g_value_unset (¶ms[1]);
+
+ return result;
+}
+#endif
+
+static gboolean