[Twisted-Python] Exit all threads upon KeyboardInterrupt

johnnadre johnnadre at zoho.com
Sun Jan 12 17:42:37 MST 2014


---- On Sun, 12 Jan 2014 14:03:24 -0800 <exarkun at twistedmatrix.com> wrote ---- 

 > On 09:01 pm, johnnadre at zoho.com wrote: 
 > > 
 > >Hi, 
 > > 
 > >I want to exit my application immediately when CTRL+C is pressed,  
 > >however reactor hangs when there are running threads. 
 > >Some of these threads have blocking I/O, so I can't simply set a  
 > >variable or wait for them to terminate. An example application would  
 > >be: 
 >  
 > Python threads (being plain old operating systems; for example, POSIX  
 > threads) aren't generally interruptable.  You could try exiting the  
 > entire process using `os._exit`. 
 >  
 > This is the case whether you're using Twisted or not. 

Thanks! That's exactly what I was looking for.




More information about the Twisted-Python mailing list