[ CCode ( cname = "g_io_create_watch" ) ]
public IOSource (IOChannel channel, IOCondition condition)

Creates a SignalSource that's dispatched when condition is met for the given channel.

For example, if condition is IN, the source will be dispatched when there's data available for reading.

The callback function invoked by the SignalSource should be added with set_callback, but it has type IOFunc (not SourceFunc).

add_watch 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 SignalSource 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.



a IOChannel to watch


conditions to watch for


a new SignalSource