[cpp-threads] Re: Exception propogation across threads

Kevlin Henney kevlin at curbralan.com
Wed Feb 21 20:40:43 GMT 2007


"Boehm, Hans" <hans.boehm at hp.com> writes
>>
>> Unwind the stack, terminate the thread and throw some kind of
>> unexpected thread-death exception in the joining thread. Less
>> severe than (i) and (ii), less compiler magic or modification
>> of exceptions needed than
>> (iii) and (iv), and more usable than (v).
>>
>My recollection from the last discussion is that this has the (probably
>fatal?) flaw that the join may not be executed until next month.  Thus
>you could effectively be hiding the exception for a month.  Since it
>escaped the thread, it was presumably not completely handled, so we are
>now letting the application run in a bad state for a month, potentially
>wreaking all sorts of havoc.

When I first implemented the model I described, I included the notion of 
a handler being called for just this reason. This approach is mentioned 
in N1883. Following completion of any registered handler the thread 
would terminate. Any immediate and urgent business that needed to be 
handled has been handled. OTOH, if a month is what it takes to then 
join, then that could be considered either a feature or a fault of the 
designed system in question ;->

>It seems to me that the best choice is essentialy (i), with enough
>facilities to let libraries implement other policies as needed.

This still seems unnecessarily severe, and perhaps it should be viewed 
the other way around? With the callback model I described, perhaps (vi) 
is the better option, with a hook for other behaviour, such as (i)? It 
would be harder to adopt (i) and then provide useful and portable 
alternatives than to adopt (vi) (or indeed (iii) or (iv)) with this 
refinement, accommodating sudden death or various stack options.

Kevlin
-- 
____________________________________________________________

   Kevlin Henney                   phone:  +44 117 942 2990
   mailto:kevlin at curbralan.com     mobile: +44 7801 073 508
   http://www.curbralan.com        fax:    +44 870 052 2289
   Curbralan: Consultancy + Training + Development + Review
____________________________________________________________




More information about the cpp-threads mailing list