Terminating threaded programs

Aahz aahz at pythoncraft.com
Thu Feb 11 11:43:45 EST 2010


In article <mailman.1961.1265383809.28905.python-list at python.org>,
mk  <mrkafk at gmail.com> wrote:
>
>I have a problem with a threaded program: it frequently hangs on sys.exit.
>
>The problem is that my program uses threads which in turn use paramiko 
>library, which itself is threaded.
>
>I try to gracefully close the threads (below), but it doesn't always 
>work, if paramiko calls happen to be at stage of negotiating ssh 
>connection or smth similar.
>
>The only workable solution I have is a program sending itself SIGKILL, 
>which makes it terminated by OS (I think so).

You can also use os._exit().
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"At Resolver we've found it useful to short-circuit any doubt and just        
refer to comments in code as 'lies'. :-)"



More information about the Python-list mailing list