Get thread pid
mabdelkader at gmail.com
Fri Jan 30 17:53:46 CET 2009
I think issue here is that you're invoking a system call (using either the
subprocess module or os.popen*) from your threads. Those *are* external
processes and will show up under pstree since they have a parent process. If
you're using subprocess.Popen() the object that is returned has an attribute
'pid' that can be accessed (which would serve your purpose).
Please note that *this is NOT a thread id*
On Fri, Jan 30, 2009 at 11:33 AM, Alejandro
<alejandro.weinstein at gmail.com>wrote:
> On Jan 30, 9:11 am, Jean-Paul Calderone <exar... at divmod.com> wrote:
> > [clarification about threads]
> Thank you for the clarification. I will reformulate my question:
> pstree and also ntop (but not top) show a number for each thread, like
> for instance:
> $pstree -p 9197
> Is is possible to get the number corresponding to each thread?
> The reason I am interested is because one of my thread is hogging the
> CPU, and want to find which one is the culprit.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list