Method

GioTaskattach_source

since: 2.36

Declaration

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

Description

A utility function for dealing with async operations where you need to wait for a GSource to trigger. Attaches source to tasks GMainContext with tasks priority, and sets sources 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 function.
callback

Type: GSourceFunc

The callback to invoke when source triggers.