catch(...) and forced unwind

Mark Mitchell mark@codesourcery.com
Wed Dec 17 22:59:00 GMT 2003


On Wed, 2003-12-17 at 11:25, Jakub Jelinek wrote:
> On Wed, Dec 17, 2003 at 01:20:33PM -0800, Mark Mitchell wrote:
> > On Wed, 2003-12-17 at 12:30, Richard Henderson wrote:
> > > On Wed, Dec 17, 2003 at 10:36:15AM -0800, Mark Mitchell wrote:
> > > > That would also be a POSIX threads extension; essentially, this would be
> > > > the deferred cancellation model, except that pthread_testcancel would be
> > > > the only cancellation point.
> > > 
> > > I would think that disabling cancellation and then using testcancel
> > > would be equivalent.
> > 
> > I don't think so; pthread_setcancelstate (PTHREAD_CANCEL_DISABLE) means
> > that the thread will not receive cancellation requests at all.
> 
> No.  PTHREAD_CANCEL_DISABLE means that cancellation requests are queued.
> See http://www.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_09.html#tag_02_09_05_01

Ah.  

That was not clear to me from the GNU/Linux info files, but I should
have gone to the source.

Given that, I agree with you and Richard: David's alternative is
equivalent to just disabling cancellation, and then using
pthread_testcancel at appropriate points.  No additional
compiler/library support is required to implement that model.

Thanks,

-- 
Mark Mitchell <mark@codesourcery.com>
CodeSourcery, LLC



More information about the Gcc mailing list