catch(...) and forced unwind

Jamie Lokier jamie@shareable.org
Thu Dec 18 16:48:00 GMT 2003


Matt Austern wrote:
> Note that it's possible to temporarily disable thread cancellation in
> critical regions of code.  It might be appropriate for glibc and/or
> libstdc++ to do that.  On the other hand, we'll have to think carefully
> about standard conformance if we do something like that.

Why not make C++ "throw()" functions automatically disable thread
cancellation when they are entered and restore the state when they exit?

The code to do this could be optimised away with glibc support, but
conceptually it's a pair of pthread_setcancelstate() calls.

That doesn't violate pthreads - it's a change to C++, not pthreads.
I'm not sure if it violates C++.

-- Jamie



More information about the Gcc mailing list