This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: catch(...) and forced unwind
- From: David Abrahams <dave at boost-consulting dot com>
- To: Jamie Lokier <jamie at shareable dot org>
- Cc: Matt Austern <austern at apple dot com>, Jason Merrill <jason at redhat dot com>, Ulrich Drepper <drepper at redhat dot com>, gcc at gcc dot gnu dot org, Richard Henderson <rth at redhat dot com>, Nathan Myers <ncm at cantrip dot org>, Jakub Jelinek <jakub at redhat dot com>, wekempf at cox dot net, Mark Mitchell <mark at codesourcery dot com>, fjh at cs dot mu dot oz dot au, Benjamin Kosnik <bkoz at redhat dot com>, William Kempf <williamkempf at hotmail dot com>
- Date: Thu, 18 Dec 2003 10:34:27 -0500
- Subject: Re: catch(...) and forced unwind
- References: <xypwu91ofvf.fsf@miranda.boston.redhat.com><ud6at1wvg.fsf@boost-consulting.com><xypekv9nr9u.fsf@miranda.boston.redhat.com><u65gkyhv4.fsf@boost-consulting.com><20031214035909.GE2416@tofu.dreamhost.com><xypk74xltaa.fsf@miranda.boston.redhat.com><ullpdlksl.fsf@boost-consulting.com><xyp1xr5lh5q.fsf@miranda.boston.redhat.com><usmjlhryu.fsf@boost-consulting.com><278A5A0A-3001-11D8-8564-00039390D9E0@apple.com><20031218133852.GA16315@mail.shareable.org>
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