Boost logo

Boost :

Subject: Re: [boost] [Thread] Win32 exception handling
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2008-11-25 23:26:16


On Tue, Nov 25, 2008 at 19:32, Emil Dotchevski <emil_at_[hidden]> wrote:
>
> Suppose your compiler doesn't call terminate() when exceptions
> propagate out of thread functions but you want to implement
> boost::thread in a way that's conformant with the standard (so, you
> are not the compiler, and can't use compiler magic.)
>
> The only way to do this is to catch(...) and then call terminate().
> The problem is, if you catch(...) you've just killed the stack trace
> your compiler could give you.
>

Why wouldn't an empty exception specification work? It seems like the
unexpected() call should call terminate() without ever doing an
explicit catch (...).

Of course, this depends on the compiler implementing exception
specifications properly, and since Visual C++ doesn't ("However, if an
exception is thrown out of a function marked throw(), the Visual C++
compiler will not call unexpected" ~
http://msdn.microsoft.com/en-us/library/wfa0edys.aspx ), it might give
exactly what Dave's contact wants.

~ Scott


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