### Function

# GLib Source set_name_by_id

since: 2.26

#### Declaration

    void
    g_source_set_name_by_id (
      guint tag,
      const char* name
    )

#### Description

Sets the name of a source using its ID.

This is a convenience utility to set source names from the return value of g_idle_add(), g_timeout_add(), etc.

It is a programmer error to attempt to set the name of a non-existent source.

More specifically: source IDs can be reissued after a source has been destroyed and therefore it is never valid to use this function with a source ID which may have already been removed. An example is when scheduling an idle to run in another thread with g_idle_add(): the idle may already have run and been removed by the time this function is called on its (now invalid) source ID. This source ID may have been reissued, leading to the operation being performed against the wrong source.

Available since: 2.26

#### Parameters

`tag`

  Type: `guint`

  A `GSource` ID.

`name`

  Type: `const char*`

  Debug name for the source.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.