On 2015/05/05 13:32, Jérémie Courrèges-Anglas wrote:
> 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).

Perfect, thanks :)

> > 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.

No problem, that's not needed with the above information.


Reply via email to