Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-08-23 13:05:00


--- In boost_at_y..., duncan_at_s... wrote:
> pdimov_at_m... (Peter Dimov) wrote:
>
> > Ending a thread:
> >
> > No library support is necessary. A thread can terminate itself by
> > throwing an exception of type "thread_end" or a type derived from
> > thread_end.
> >
> > When a thread_end (or derived) exception escapes from the thread
> > procedure (function object operator()), the thread is terminated
as if
> > it had returned normally.
> >
> > When an exception other than thread_end (or derived) escapes from
the
> > thread procedure, {boost,std}::thread_terminate() is called. It
does
> > nothing by default unless a user-specific handler has been
installed
> > via set_thread_terminate(handler), in which case that handler is
> > invoked. The thread is then terminated as if it had returned
normally.
>
> 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. It causes too much
> grief during program development, especially for those who are
still
> getting to grips with the system for the default to be silent
thread
> exit. I've had bad experiences with Java in this regard. They were
not
> horrendously bad, but wasted quite a bit of time on several
occasions.

Any number of things can cause "silent thread exit". Cancelation,
calls to exit(), simply returning from the entry function. All
exhibit the same behavior as that proposed for exception handling. I
see no real issue here.

> Of course the design should enable you to override this default
> behaviour to achieve what you want.

Yes, we just differ in what we think the "default" should be.

Bill Kempf


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk