[glib: 3/6] gtask: Include task name in complete_in_idle_cb source name
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 3/6] gtask: Include task name in complete_in_idle_cb source name
- Date: Tue, 7 Jul 2020 10:58:01 +0000 (UTC)
commit 6f281ce2e582e05f93465ce7d786b060a133f5f8
Author: Philip Withnall <withnall endlessm com>
Date: Thu Jun 25 22:26:15 2020 +0100
gtask: Include task name in complete_in_idle_cb source name
`complete_in_idle_cb()` shows up in a lot of sysprof traces, so it’s
quite useful to include the most specific contextual information we can
in it.
Signed-off-by: Philip Withnall <withnall endlessm com>
gio/gtask.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/gio/gtask.c b/gio/gtask.c
index e2877dcd9..fc992c7f9 100644
--- a/gio/gtask.c
+++ b/gio/gtask.c
@@ -1241,6 +1241,7 @@ g_task_return (GTask *task,
GTaskReturnType type)
{
GSource *source;
+ gchar *source_name = NULL;
if (type != G_TASK_RETURN_FROM_THREAD)
task->ever_returned = TRUE;
@@ -1289,7 +1290,10 @@ g_task_return (GTask *task,
/* Otherwise, complete in the next iteration */
source = g_idle_source_new ();
- g_source_set_name (source, "[gio] complete_in_idle_cb");
+ source_name = g_strdup_printf ("[gio] %s complete_in_idle_cb",
+ (task->name != NULL) ? task->name : "(unnamed)");
+ g_source_set_name (source, source_name);
+ g_free (source_name);
g_task_attach_source (task, source, complete_in_idle_cb);
g_source_unref (source);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]