since: 2.26


g_source_set_name (
  GSource* source,
  const char* name


Sets a name for the source, used in debugging and profiling. The name defaults to NULL.

The source name should describe in a human-readable way what the source does. For example, “X11 event queue” or “GTK repaint idle handler” or whatever it is.

It is permitted to call this function multiple times, but is not recommended due to the potential performance impact. For example, one could change the name in the “check” function of a GSourceFuncs to include details like the event type in the source name.

Use caution if changing the name while another thread may be accessing it with g_source_get_name(); that function does not copy the value, and changing the value will free it while the other thread may be attempting to use it.

Also see g_source_set_static_name().

Available since: 2.26



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.