Re: [c++-pthreads] Restating the Jason model
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [c++-pthreads] Restating the Jason model
- To: Wil Evers <wil@xxxxxxxxxxxxxx>
- Subject: Re: [c++-pthreads] Restating the Jason model
- From: Alexander Terekhov <boo@xxxxxxxxxxx>
- Date: Tue, 13 Jan 2004 23:00:17 +0100
Wil Evers wrote:
>
> Jason Merrill wrote:
>
> > On Tue, 13 Jan 2004 07:47:17 -0500, Dave Butenhof <David.Butenhof@xxxxxx> wrote:
> >
> >>Cancellation should NOT be disabled in destructors? Did you mean to say
> >>that?
> >
> > Yes. Destructors can be run under two different situations:
> >
> > 1) when the object goes out of scope during normal execution;
> > 2) when unwinding the stack during exception handling.
This list is incomplete.
> >
> > In #1, an exception thrown out of a destructor is propagated normally. In
> > the #2, it causes a call to terminate(). So we need to suppress
> > cancellation for #2, but not (necessarily) #1.
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_active.html#265
>
> It is true that an exception escaping from a destructor will not trigger
> immediate program termination when the program/thread in question is not
> unwinding; however, that doesn't mean there's nothing to worry about.
Clearly, objects with throwing destructors aren't "normal citizens",
so to say. Again, why don't YOU (together with Ross) complain that
destructors are allowed currently to throw anything by default
instead of having implicit throw() ("by default") ES/throw spec.
imposed on them? And fixing semantics of throw specs [using them for
"fencing" under 2-phase EH] is the next step, BTW. Look, once you'll
have that, "intelligent" thread cancellation won't make your life any
harder... well, unless you really insist on using blindly-swallowing
catch(.../std::exception) in sort of "each and every destructor just
in case".
regards,
alexander.