### Method

# GLib Source add_child_source

since: 2.28

#### Declaration [src]

    void
    g_source_add_child_source (
      GSource* source,
      GSource* child_source
    )

#### Description [src]

Adds `child_source` to `source` as a “polled” source; when `source` is added to a `GMainContext`, `child_source` will be automatically added with the same priority, when `child_source` is triggered, it will cause `source` to dispatch (in addition to calling its own callback), and when `source` is destroyed, it will destroy `child_source` as well. (`source` will also still be dispatched if its own prepare/check functions indicate that it is ready.)

If you don’t need `child_source` to do anything on its own when it triggers, you can call `g_source_set_dummy_callback()` on it to set a callback that does nothing (except return `TRUE` if appropriate).

`source` will hold a reference on `child_source` while `child_source` is attached to it.

This API is only intended to be used by implementations of `GSource`. Do not call this API on a `GSource` that you did not create.

Available since: 2.28

#### Parameters

`child_source`

  Type: `GSource`

  A second `GSource` that `source` should “poll”.

  The data is owned by the caller of the method.