[cpp-threads] RE: Exception propogation across threads

Boehm, Hans hans.boehm at hp.com
Thu Feb 22 19:08:54 GMT 2007


Thanks, Howard.

> 
> *  Not positive, but I believe java defaults to thread-only 
> termination but with a stack trace printed to the console. 
> http://java.sun.com/docs/books/jls/second_edition/html/excepti
> ons.doc.html
> http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ThreadGroup.
> html#uncaughtException(java.lang.Thread,%20java.lang.Throwable)
> 
That was also my reading, except that the cancellation equivalent is
handled differently, as it needs to be.

But again, Java is in a somewhat different situation.  Untrusted
sandboxed code can certainly raise an uncaught exception.  The question
then becomes whether you want that to kill the process.  As far as I can
tell, the decision was "no", but to still ensure that uncaught
exceptions would be unlikely to get ignored for extended periods.

Thus it seems to me that the Java decision is entirely consistent with
what I'm arguing for, particular in terms of the rules that programmers
are asked to follow.  In both cases, it is clearly undesirable to let a
recoverable error escape from the thread.

Hans



More information about the cpp-threads mailing list