[c++-pthreads] Re: pthread_cancel and EH: let's try this again

Mark Mitchell mark at codesourcery.com
Thu Jul 21 07:58:04 UTC 2005


Nathan (Jasper) Myers wrote:

> POSIX doesn't forbid running destructors; it says nothing about them.
> The specification above says that if there are any of the users' to 
> be run, the effect is undefined.  Run them, don't run them, crash, 
> whatever you like.  It's easy to conform, because it demands nothing 
> beyond what J. Random POSIX C does already.  

But the mission of this list is precisely to define the behavior, not to 
leave it undefined.

>>True -- but that is in fact the behavior that was defined in the last 
>>iteration of that debate that the behavior shown was what was wanted. 
>>That behavior isn't an accident.
>  
> Wanted by whom?  As I recall, the "zero uptake!" crowd meant for no 
> library (C or C++) to work right unless it had been written with full 
> expectation of system calls and C library functions throwing exceptions,
> even in destructors, even during ordinary-exception unwinding.  Falling
> out of the catch clause was just one sticky detail.

It was posited that cancellation mapped to an exception, and that so 
long as this exception was rethrown, stack unwinding happened in the 
usual way.

I understand that you think that mapping cancellation to an exception, 
and thereby changing C functions that did not previously throw 
exceptions into functions that do, is a bad idea.  However, I think one 
of the axioms for this discussion was that this is in fact a good idea.

In other words, I think the context here is that we're assuming POSIX 
cancellation points throw a cancellation exception; the question is how 
things behave from there.  I don't think that throwing out this 
assumption is productive, because I don't think you'll ever get the 
broader community to accept anything else.

I'm not necessarily disliking what you're saying; I'm just don't see it 
as pragmatic.  However, if you can do it all at user level, and people 
like your solution, more power to you!

All in all, I think I've once again spent quite enough time on this 
discussion.  The status quo is actually OK with me, in that if your 
program does not abort, it behaves in a way I find plausible.  So, until 
there's some indication that someone is going to try to actually 
implement something, I'll just go back to worrying about other things.

-- 
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com
(916) 791-8304



More information about the c++-pthreads mailing list