On Jan 12, 2014, at 4:42 PM, johnnadre <johnna...@zoho.com> wrote:

> 
> ---- On Sun, 12 Jan 2014 14:03:24 -0800 <exar...@twistedmatrix.com> wrote 
> ---- 
> 
>> On 09:01 pm, johnna...@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`. 

Well, there's always pthread_kill, now exposed as os.pthread_kill on Python 
3.3, but ... don't do that.  Nothing good will come of it.

>> This is the case whether you're using Twisted or not. 
> 
> Thanks! That's exactly what I was looking for.

If you need to use os._exit, your application probably has a bug :-).

(Not to say you should never use it, but any time you use it you should be 
simultaneously looking into why you need to.)

-glyph

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to