sys.settrace for all threads

Richie Hindle richie at entrian.com
Fri Oct 4 23:39:09 CEST 2002


Hi,

sys.settrace sets the trace function for the current thread.  What I'd
like is a way of setting it for all threads.  I've written a code
coverage module, which a friend is trying to run with his omniORBpy
server (Hi Alik!).  The server is multithreaded, with each thread
being started by omniORBpy, so there's no convenient place for him to
install the coverage module's trace function for the threads.

I've written an experimental nasty hack that involves replacing
thread.start_new_thread and threading._start_new_thread with another
function that installs the trace function, but that's pretty nasty
(and I don't yet know whether it even works).  Is there a cleaner and
more future-proof way of doing this?

-- 
Richie Hindle
richie at entrian.com



More information about the Python-list mailing list