[cpp-threads] Issue 1369 --- thread safety of std::rethrow_exception

Detlef Vollmann dv at vollmann.ch
Sat Nov 13 15:01:03 GMT 2010


On Sat, 13 Nov 2010 04:16:42 +0000
"Boehm, Hans" <hans.boehm at hp.com> wrote:

> I'm unclear about (a) why you would want to modify the exception, and (b) how common that is in practice.  Can someone enlighten me?  I normally think of exceptions as information that's read by the handler.  Is there another scenario that I'm missing?  Is there a common use case that we break?
One possible use case for modifying the exception object might be to use
the exception object for some housekeeping, i.e. you register all the
objects that have already been cleaned up correctly.
The interesting point here is that for this you really want one single
exception object, and not multiple copies floating around.

I think if you really want a copy, you should make it yourself
(using some clone() function).
If you get a copy, it's impossible to go back to the original exception object.

I have to admit that I don't know whether we currently allow (multiple)
copies, but if we do, I think that's wrong.

  Detlef



More information about the cpp-threads mailing list