After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 580505 - add a way to set/get name for a thread
add a way to set/get name for a thread
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gthread
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
: 605173 654252 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-04-27 20:41 UTC by Stefan Sauer (gstreamer, gtkdoc dev)
Modified: 2011-10-03 15:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Allow giving names to threads (6.71 KB, patch)
2011-09-30 05:19 UTC, Matthias Clasen
none Details | Review

Description Stefan Sauer (gstreamer, gtkdoc dev) 2009-04-27 20:41:58 UTC
Associating a name with threads is helpful when debugging multithreaded apps.

linux + pthread: (not portable :/)
http://www.heise.de/developer/foren/S-Re-Pthreads-einen-Namen-geben/forum-44546/msg-16039431/read/

win32: (its a big hack :/)
http://blogs.msdn.com/stevejs/archive/2005/12/19/505815.aspx
http://thetweaker.wordpress.com/2009/04/10/naming-threads/

does anyone know something better?
Comment 1 Marc-Andre Lureau 2009-04-28 22:02:52 UTC
Miguel replied to me on stackoverflow about that:

http://stackoverflow.com/questions/139859/setting-the-thread-proc-pid-cmdline/

:)
Comment 2 Florent Thiéry 2009-09-17 08:06:50 UTC
It seems portability would be quite quite hard to achieve here: For Win, it looks like it's only for MS Debuggers...
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2010-03-15 09:48:01 UTC
*** Bug 611911 has been marked as a duplicate of this bug. ***
Comment 4 Matthias Clasen 2011-09-05 02:55:32 UTC
*** Bug 654252 has been marked as a duplicate of this bug. ***
Comment 5 Matthias Clasen 2011-09-05 02:58:09 UTC
*** Bug 605173 has been marked as a duplicate of this bug. ***
Comment 6 Matthias Clasen 2011-09-30 05:19:34 UTC
Created attachment 197846 [details] [review]
Allow giving names to threads

These show up in 'info threads' in gdb (as well as
in /proc/$PID/task/$TID/comm).
Comment 7 Allison Karlitskaya (desrt) 2011-09-30 05:24:13 UTC
Review of attachment 197846 [details] [review]:

nice abuse of retval...

we could s/create/new/, which would give us a second try at the _full() API

we could also introduce some sort of attributes structure (similar to what posix does)
Comment 8 Matthias Clasen 2011-09-30 11:57:57 UTC
(In reply to comment #7)
> Review of attachment 197846 [details] [review]:
> 
> nice abuse of retval...

Yeah, I meant to add a comment about it somewhere. I also had some doubts about the memory management there; maybe we do need to copy that string after all...

> we could s/create/new/, which would give us a second try at the _full() API

That's an idea.

> we could also introduce some sort of attributes structure (similar to what
> posix does)

Umm, the posix attribute stuff strikes me as clumsy at best. It is extensible, but that is about its only positive characteristic...
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2011-10-03 15:58:15 UTC
Has the patch been committed?