Shanon wrote:
> I would to know if there're some way to have a dump of all the threads
> started by a python process. I want to see the TID corresponding of each
> thread because I need them to get the CPU time of each thread by the command
> top.

threading.enumerate() will return a list of all threading.Thread objects 
that have been created (including the main one), but Thread's do not 
currently store the identified of the underlying thread (created by a 
call to thread.start_new_thread().  You could easily subclass Thread to 
provide your own .start() which does that, and perhaps modify __repr__ 
to output that instead of the id() value.

Check the source in threading.py if this approach sounds useful.

-Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to