A notification to be read through the #GIOChannel which is returned by gda_thread_wrapper_get_io_channel(), for example: <![CDATA[ gboolean wrapper_ioc_cb (GIOChannel *source, GIOCondition condition, gpointer data) { GIOStatus status; gsize nread; GdaThreadNotification notif; if (condition & G_IO_IN) { status = g_io_channel_read_chars (source, (gchar*) ¬if, sizeof (notif), &nread, NULL); if ((status != G_IO_STATUS_NORMAL) || (nread != sizeof (notif))) goto onerror; switch (notif.type) { case GDA_THREAD_NOTIFICATION_JOB: check_for_wrapper_result (bcnc); break; case GDA_THREAD_NOTIFICATION_SIGNAL: gda_thread_wrapper_iterate (bcnc->priv->wrapper, FALSE); break; default: goto onerror; break; } } if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) goto onerror; return TRUE; // keep callback
onerror: g_io_channel_shutdown (bcnc->priv->ioc, FALSE, NULL); return FALSE; // removed callback }
{ [...] GIOChannel *ioc; ioc = gda_thread_wrapper_get_io_channel (wrapper); if (!ioc) [handle error] else { guint watch_id; watch_id = g_io_add_watch (ioc, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, (GIOFunc) wrapper_ioc_cb, NULL); } } ]]>
the job ID, if type is a #GDA_THREAD_NOTIFICATION_JOB
type
the notification type
A notification to be read through the #GIOChannel which is returned by gda_thread_wrapper_get_io_channel(), for example:<![CDATA[
gboolean
wrapper_ioc_cb (GIOChannel *source, GIOCondition condition, gpointer data)
{
GIOStatus status;
gsize nread;
GdaThreadNotification notif;
if (condition & G_IO_IN) {
status = g_io_channel_read_chars (source, (gchar*) ¬if, sizeof (notif), &nread, NULL);
if ((status != G_IO_STATUS_NORMAL) || (nread != sizeof (notif)))
goto onerror;
switch (notif.type) {
case GDA_THREAD_NOTIFICATION_JOB:
check_for_wrapper_result (bcnc);
break;
case GDA_THREAD_NOTIFICATION_SIGNAL:
gda_thread_wrapper_iterate (bcnc->priv->wrapper, FALSE);
break;
default:
goto onerror;
break;
}
}
if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL))
goto onerror;
return TRUE; // keep callback
onerror: g_io_channel_shutdown (bcnc->priv->ioc, FALSE, NULL); return FALSE; // removed callback }
{ [...] GIOChannel *ioc; ioc = gda_thread_wrapper_get_io_channel (wrapper); if (!ioc) [handle error] else { guint watch_id; watch_id = g_io_add_watch (ioc, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, (GIOFunc) wrapper_ioc_cb, NULL); } } ]]>