[c++-pthreads] Restating the Jason model
Wil Evers
wil at bogo.xs4all.nl
Tue Jan 13 20:19:15 UTC 2004
Jason Merrill wrote:
> On Tue, 13 Jan 2004 07:47:17 -0500, Dave Butenhof <David.Butenhof at hp.com> 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.
>
> 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.
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.
The most likely symptom is a resource leak; in a multi-threaded
environment, that could mean a deadlock.
- Wil
More information about the c++-pthreads
mailing list