PollableOutputStream.createSource

glib.source.Source createSource(gio.cancellable.Cancellable cancellable = null)

Creates a #GSource that triggers when stream can be written, or cancellable is triggered or an error occurs. The callback on the source is of the #GPollableSourceFunc type.

As with [gio.pollable_output_stream.PollableOutputStream.isWritable], it is possible that the stream may not actually be writable even after the source triggers, so you should use [gio.pollable_output_stream.PollableOutputStream.writeNonblocking] rather than [gio.output_stream.OutputStream.write] from the callback.

The behaviour of this method is undefined if [gio.pollable_output_stream.PollableOutputStream.canPoll] returns false for stream.

Parameters

cancellablea #GCancellable, or null

Returns

a new #GSource