Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2008-05-08 04:58:16


"James Talbut" <James.Talbut_at_[hidden]> writes:

> By calling std::terminate in the catch handler we lose the JIT debugger
> - and thus information about what the exception is that we haven't
> caught.
> Without the catch the process is still going to be killed, so what's the
> benefit of having that?

It's not specified in either the pthreads docs or the Windows docs what
happens if the thread function leaks an exception, since these are C
APIs. Depending on the compiler/platform a leaked exception in a thread may
either just terminate the thread, may terminate the whole process, or may
cause undefined behaviour. I know that some platforms don't support exceptions
in C stack frames, and will throw a wobbly.

By catching the exception and calling terminate(), the thread library makes it
explicit that this is an error.

Anthony

-- 
Anthony Williams            | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

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