Stuart Henderson <[email protected]> writes:

> I am trying to track down some threads which are seeing high cpu use in
> top(1), but can't work out how to track back from any information available
> from struct kinfo_proc back to a thread ID as returned by pthread_self().
>
> The threaded program can print a nice display of its own internal concept
> of "thread name", with the value returned by pthread_self(), and on some OS
> it also stores what I think is their equivalent of our p_tid, e.g. on linux
> it uses syscall(SYS_gettid).
>
> Do we have a way within a threaded program to determine the current thread's
> p_tid?

If I'm not mistaken that would be getthrid(2).

> Or is there a way to go from p_tid (or something else available in struct
> kinfo_proc) back to a thread ID returned by pthread_self()?

No idea.

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to