This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: catch(...) and forced unwind


Jamie Lokier <jamie@shareable.org> writes:

> 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++.

IIUC The 'C' lib functions are "throw()" when invoked from C++, so if
pthreads mandates that C I/O functions throw in C++, I think your idea
does violate pthreads.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]