Gio.PollableOutputStream.create_source

### Method

# Gio PollableOutputStreamcreate_source

since: 2.28

#### Declaration [src]

    GSource*
    g_pollable_output_stream_create_source (
      GPollableOutputStream* stream,
      GCancellable* cancellable
    )

#### Description [src]

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 g_pollable_output_stream_is_writable(), it is possible that the stream may not actually be writable even after the source triggers, so you should use `g_pollable_output_stream_write_nonblocking()` rather than `g_output_stream_write()` from the callback.

The behaviour of this method is undefined if `g_pollable_output_stream_can_poll()` returns `FALSE` for `stream`.

Available since: 2.28

#### Parameters

`cancellable`

  Type: `GCancellable`

  A `GCancellable`, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

#### Return value

Type: `GSource`

A new `GSource`.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.