Making a timebomb

Cantankerous Old Git CantankerousOldGit at
Mon Aug 8 21:54:46 CEST 2005

Peter Hansen wrote:
> Cantankerous Old Git wrote:
>> Peter Hansen wrote:
>>> Cantankerous Old Git wrote:
>>>> The dirty way, which can leave corrupt half-written files and other 
>>>> nasties, is something like sys.exit().
>>> sys.exit() won't help you if your server is running in the main 
>>> thread, nor if your server thread is not marked as a daemon, but that 
>>> does raise another possibility.  
>> I assume you know that I actually meant System.exit(). Why do you 
>> think that won't help?
> No, I didn't know that, but if you were confused the first time, I think 
>  you're getting even more confused now.  What is System.exit()?  I don't 
> have one, and have never seen it mentioned.  Perhaps you meant 
> SystemExit, the exception that's raised when you call sys.exit()?  If 
> so, I still don't see your point, because there's no difference between 
> the two in this context.
> Maybe you meant os._exit()?  Now *that* one is messy, and will work as 
> you described.
> -Peter


Yup - I guess you're not interested in java.lang.System.exit() at 
all, are you. You're right about me getting confused!

Perhaps I should take a break between reading the two newsgroups. 

sys.exit() docs (for Python) say it raises a SystemExit 
exception. A quick test shows that:
* You can catch this to prevent being killed
* It only gets raised on the calling thread - not the others

So you're right - sys.exit is not very helpful in this case.

os._exit is the one I was thinking of - equivalent to java's 

And to the OP, Bill - sorry for messing you around. As you see - 
I got confused.

More information about the Python-list mailing list