mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-11-03 01:42:18 +01:00
Make thread names useful in a debugger
Associate the name with the system thread, so that debuggers can see it. This is currently only implemented for Linux, using prctl. https://bugzilla.gnome.org/show_bug.cgi?id=660635
This commit is contained in:
@@ -63,7 +63,9 @@
|
||||
#ifdef HAVE_SCHED_H
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_PRCTL_H
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
static void
|
||||
g_thread_abort (gint status,
|
||||
@@ -1047,5 +1049,13 @@ g_system_thread_equal (gpointer thread1,
|
||||
return (pthread_equal (*(pthread_t*)thread1, *(pthread_t*)thread2) != 0);
|
||||
}
|
||||
|
||||
void
|
||||
g_system_thread_set_name (const gchar *name)
|
||||
{
|
||||
#ifdef HAVE_SYS_PRCTL_H
|
||||
prctl (PR_SET_NAME, name, 0, 0, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* {{{1 Epilogue */
|
||||
/* vim:set foldmethod=marker: */
|
||||
|
||||
Reference in New Issue
Block a user