threading: how to kill a (possibly blocked) thread?

George Young gry at ll.mit.edu
Tue Jan 16 14:24:20 EST 2001


[python2.0/linux 2.2.16/i686]
I'm using the threading module in a multithreaded server, with
Socketserver's ThreadingTCPServer.  My handler thread spawns a 
couple of other threads, each of which may block on wfile.write or
rfile.read, or RLock.acquire.
It appears that when the handler thread exits,
sometimes a child may hang around blocked forever.  I end up with
hundreds of hung threads and eventually may run out of processes.

I would like
to do an explicit 'kill' from the handler -- but there's no such
call available through the Threading API.  I notice an 'exit'
function in the 'thread' module that 'Threading' claims to be built on.

Is there a way to get a 'thread' reference from my Threading object
and call it's exit function?  Will this confuse Threading and break
other things?

Thanks,
	George
-- 
Your mouse has moved.
Windows NT must be restarted for the change to take effect.
Reboot now?  [OK]



More information about the Python-list mailing list