Boost logo

Boost :

From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2006-07-09 04:58:10


Gregory Dai wrote:

>I've got a related question: Assume a multithreaded C++ program, if one
>thread is handling an exception while another thread starts to throw one,
>what would happen? terminate() will be called?
>
>
That's more suited to c.l.c++.m or perhaps the C++ standard discussion
group. However, for what it's worth, the current C++ standard
effectively ignores the existence of multithreading; thus pretty much
everything concerning threading is implementation-defined. You might
want to write a test case (Take two threads. Have one waiting for a
signal. The other throws an exception. In the catch handler, signal the
other thread, then wait for a signal yourself. The other thread starts
running and throws an exception too. Is terminate() called? Then have
the second thread catch the exception, signal the other thread, and
terminate. Examine the contents of the first thread's exception, if it
is still the same, or if it was overwritten by the other thread.) and
bring the issue up with the GCC developers.

IMO, exception handling is a execution flow issue and should thus be
completely thread-local.

Sebastian Redl


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