Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pthread_setname_np

5 views
Skip to first unread message

us...@domain.invalid

unread,
Mar 30, 2002, 7:53:24 PM3/30/02
to
Hello

Why is it not possible to give each thread a name, so that you can get
more useful info in "top" and "gdb" so you can get a human readable name
of a thread, instead of just a number.

Cheers

James

David Butenhof

unread,
Apr 1, 2002, 8:17:53 AM4/1/02
to
us...@domain.invalid wrote:

Well, if you were programming on Tru64 UNIX or OpenVMS, you'd just call
pthread_setname_np() [or, better, pthread_attr_setname_np() BEFORE creating
the thread], and you'd be pretty much set. There's also, of course,
pthread_mutex_setname_np(), pthread_cond_setname_np(), and of course
pthread_rwlock_setname_np(). (I didn't bother with an attribute except for
threads, since the other objects can't be used until "advertised".)

I've several times cast out "hints" on this group to suggest that other
developers might want to pick up these interfaces. As far as I know, nobody
has. Weird. ;-)

[Although, to be fair and complete, setting names won't help you in "top",
which shows PROCESSES. On Linux threads ARE processes, but on most systems
they're not. In any case, since top uses process information interfaces,
which don't have support for names and aren't likely to, you're not likely
to see any effect there. Debuggers, and other analyzers sensitive to
threads, are a different matter.]

/------------------[ David.B...@compaq.com ]------------------\
| Compaq Computer Corporation POSIX Thread Architect |
| My book: http://www.awl.com/cseng/titles/0-201-63392-2/ |
\-----[ http://home.earthlink.net/~anneart/family/dave.html ]-----/

0 new messages