Gio.Task.attach_source

### Method

# Gio Taskattach_source

since: 2.36

#### Declaration [src]

    void
    g_task_attach_source (
      GTask* task,
      GSource* source,
      GSourceFunc callback
    )

#### Description [src]

A utility function for dealing with async operations where you need to wait for a `GSource` to trigger. Attaches `source` to `task`‘s `GMainContext` with `task`‘s priority, and sets `source`‘s callback to `callback`, with `task` as the callback’s `user_data`.

It will set the `source`’s name to the task’s name (as set with g_task_set_name()), if one has been set on the task and the source doesn’t yet have a name.

This takes a reference on `task` until `source` is destroyed.

Available since: 2.36

This method is not directly available to language bindings.

#### Parameters

`source`

  Type: `GSource`

  The source to attach.

  The data is owned by the caller of the method.

`callback`

  Type: `GSourceFunc`

  The callback to invoke when `source` triggers.