[cpp-threads] Re: Exception propogation across threads

Anthony Williams anthony at justsoftwaresolutions.co.uk
Thu Feb 22 10:37:17 GMT 2007


"Paul E. McKenney" <paulmck at linux.vnet.ibm.com> writes:

> On Wed, Feb 21, 2007 at 10:09:21PM +0000, Kevlin Henney wrote:
>> I am concerned that making total process death the chosen behaviour 
>> shows a default bias towards coarse-grained threading, just as we are 
>> moving into the era of fine-grained threading. As I said before, killing 
>> the whole process seems unnecessarily severe: feel free to consider it 
>> an option, but we should avoid imposing what some (myself included) 
>> might consider to be unreasonable defaults.
>
> So you want some way of being able to propagate exceptions into the parent
> thread.  I don't have a problem with that, as long as it is not the default
> behavior.  I suppose the "right" thing to do would be to have another
> pthread_attr_t attribute...

How about we provide two standard handlers: one that aborts the application on
unhandled exceptions in a thread, and one that propagates the exception to the
calling thread. I'm not too fussed which is the default, but do have a slight
inclination towards "propagate".

It could well be that the "propagate" handler is a no-op, and that the
thread-launching facility actually handles the propagation, but that's a small
detail. By putting the choice in the library we avoid the user having to write
any propagation code manually, which is a good thing since that is non trivial.

Anthony
-- 
Anthony Williams
Just Software Solutions Ltd - http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL



More information about the cpp-threads mailing list