ioCreateWatch
fn
glib.source.Source ioCreateWatch(glib.iochannel.IOChannel channel, glib.types.IOCondition condition)Creates a #GSource that's dispatched when condition is met for the given channel. For example, if condition is [glib.types.IOCondition.In], the source will be dispatched when there's data available for reading.
The callback function invoked by the #GSource should be added with [glib.source.Source.setCallback], but it has type #GIOFunc (not #GSourceFunc).
[glib.global.ioAddWatch] is a simpler interface to this same functionality, for the case where you want to add the source to the default main loop context at the default priority.
On Windows, polling a #GSource created to watch a channel for a socket puts the socket in non-blocking mode. This is a side-effect of the implementation and unavoidable.
Parameters
channel | a #GIOChannel to watch |
condition | conditions to watch for |
Returns
a new #GSource