From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-08-23 13:38:11
From: "Alexander Terekhov" <terekhov_at_[hidden]>
> > > When an exception other than thread_end (or derived) escapes from the
> > > thread procedure I would strongly prefer it to stop the whole program
> > > (process). This should be the default behaviour.
> > The problem with this approach is that resources will leak. When an
> > exception escapes from main() in the single-threaded case we know that
> > stack has been unwound. When an exception escapes from a thread the
> > threads' stacks will not be unwound, and the resources they've allocated
> > will leak.
> ISO/IEC 14882:1998(E):
> "If no matching handler is found in a program,
> the function terminate() is called; whether or
> not the stack is unwound before this call to
> terminate() is implementation-defined"
I stand corrected.
So a possible point of view is that, by analogy, it should be implementation
defined whether an uncaught exception in a thread procedure terminates the
thread or the whole process. Obviously any default behavior has its
drawbacks; a portable program should not rely on the default behavior. Of
course mechanisms should be provided that make it possible to portably
choose either behavior.
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk