Boost logo

Boost :

From: duncan_at_[hidden]
Date: 2001-08-23 11:21:09


pdimov_at_[hidden] (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.

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

--
Duncan Harris, Sapio Design Ltd, Manchester, U.K.

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