gtask: Add a g_task_set_name() method

Similarly to g_source_set_name(), this sets a name on a GTask for
debugging and profiling. Importantly, this name is propagated to the
GSource for idle callbacks for the GTask, ending the glorious reign of
`[gio] complete_in_idle_cb`.

The name can be queried using g_task_get_name(). Locking is avoided by
only allowing the name to be set before the GTask is used from another
thread.

Includes tests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall
2018-10-07 17:37:58 +01:00
parent f65adb48e1
commit e89128a935
4 changed files with 109 additions and 1 deletions

View File

@@ -4396,6 +4396,7 @@ g_task_set_priority
g_task_set_check_cancellable
g_task_set_return_on_cancel
g_task_set_source_tag
g_task_set_name
<SUBSECTION>
g_task_report_error
g_task_report_new_error
@@ -4408,6 +4409,7 @@ g_task_get_return_on_cancel
g_task_get_context
g_task_get_source_object
g_task_get_source_tag
g_task_get_name
<SUBSECTION>
g_task_return_boolean
g_task_return_int