DatagramBased.createSource
glib.source.Source createSource(glib.types.IOCondition condition, gio.cancellable.Cancellable cancellable = null)Creates a #GSource that can be attached to a #GMainContext to monitor for the availability of the specified condition on the #GDatagramBased. The #GSource keeps a reference to the datagram_based.
The callback on the source is of the #GDatagramBasedSourceFunc type.
It is meaningless to specify [glib.types.IOCondition.Err] or [glib.types.IOCondition.Hup] in condition; these conditions will always be reported in the callback if they are true.
If non-null, cancellable can be used to cancel the source, which will cause the source to trigger, reporting the current condition (which is likely 0 unless cancellation happened at the same time as a condition change). You can check for this in the callback using [gio.cancellable.Cancellable.isCancelled].
Parameters
condition | a #GIOCondition mask to monitor |
cancellable | a #GCancellable |
Returns
a newly allocated #GSource