create_source


Description:

public abstract PollableSource create_source (Cancellable? cancellable = null)

Creates a SocketSource that triggers when this can be read, or cancellable is triggered or an error occurs.

The callback on the source is of the PollableSourceFunc type.

As with is_readable, it is possible that the stream may not actually be readable even after the source triggers, so you should use read_nonblocking rather than read from the callback.

The behaviour of this method is undefined if can_poll returns false for this.

Parameters:

this

a PollableInputStream.

cancellable

a Cancellable, or null

Returns:

a new SocketSource