summaryrefslogtreecommitdiff
path: root/gio/gtask.h
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2020-06-25 23:36:08 +0100
committerPhilip Withnall <withnall@endlessm.com>2020-07-07 11:17:10 +0100
commitb08bd04abe0d031fb7baa4ad2147ebe07c4a7521 (patch)
tree95f816c3c83d7077fbcf3e79901d8050f4f90fe4 /gio/gtask.h
parent7cd67c935f2999da1428d9554695b3862ee82802 (diff)
gtask: Improve task names used internally within GLib
And improve them externally, where not otherwise set, by setting them from the function name passed to `g_task_set_source_tag()`, if called by third party code. This should make profiling and debug output from GLib more useful. Signed-off-by: Philip Withnall <withnall@endlessm.com>
Diffstat (limited to 'gio/gtask.h')
-rw-r--r--gio/gtask.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gio/gtask.h b/gio/gtask.h
index 73a31e157..08ed7be72 100644
--- a/gio/gtask.h
+++ b/gio/gtask.h
@@ -78,6 +78,14 @@ GLIB_AVAILABLE_IN_2_60
void g_task_set_name (GTask *task,
const gchar *name);
+/* Macro wrapper to set the task name when setting the source tag. */
+#define g_task_set_source_tag(task, tag) G_STMT_START { \
+ GTask *_task = (task); \
+ (g_task_set_source_tag) (_task, tag); \
+ if (g_task_get_name (_task) == NULL) \
+ g_task_set_name (_task, G_STRINGIFY (tag)); \
+} G_STMT_END
+
GLIB_AVAILABLE_IN_2_36
gpointer g_task_get_source_object (GTask *task);
GLIB_AVAILABLE_IN_2_36