On Tuesday, November 5, 2002, at 05:19 PM, Jason Merrill wrote:
I believe that the purpose of this stuff is to handle pthread cleanups
using EH so that we can implement thread cancellation using EH.
Matt, you
may remember discussing this strategy at the ABI meetings (it gave
rise to
the forced_unwind stuff).
Thanks for the explanation, Jason. Yes, I can see that
motivation.
I'm still not 100% sure that I find it completely compelling,
though.
As I recall... the problem is that in a C only world, existing
pthreads implementations are fine, and in a C++ only world, EH is fine.
If one wants to combine those two features pthreads and C++, there is
a slight semantic rubbing that happens. One wants the stack cleanup
actions of threads and the stack cleanup actions of C++ to interleave
normally. From the C++ perspective, the way that we insist that this
work, is if the EH mechanism, throw, is used. If you accept that
design point, then you come to the conclusion that pthreads wants to
throw an object to cleanup, so that the C++ actions run. And from
there, we then need to use a more EH style mechanism to register the C
cleanups, so that they interleave nicely with C++.