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

Mark Mitchell mark at codesourcery.com
Fri Jul 15 00:24:57 UTC 2005


Jason Merrill wrote:
> On 13 Jul 2005 21:52:14 +0200, Gabriel Dos Reis <gdr at integrable-solutions.net> wrote:
> 
> 
>>I think cancellation should be left as ordinary C++, catchable through
>>catch(...).  I don't think we should second guess client code and
>>design a new model of exception. 
> 
> 
> My point is that making it an exception is also second-guessing client
> code which is written to use the POSIX C binding.

I do think it's possible to argue for an exception-less mode, following 
the old GNU/Linux practice of just running pthread_cleanup_push'd code. 
  It is reasonable, though perhaps not entirely desirable, to just say 
"On its face, POSIX says X, so we did X, and no more."

But, what doesn't seem reasonable is skipping "catch (...)".

I'm having a hard time overcoming the fact that all of Nathan, David, 
myself, and you -- before your conversion to plan #2 -- seemed to agree 
that #1 was better.  That's a pretty experienced set of people, with 
judgement I tend to trust.

Why not just have two modes, controlled by an environment variable, 
link-time option, or run-time variable?  In the first mode, cancellation 
would not be an exception and nothing but pthread_cleanup_push'd code is 
run, and stack unwinding of all kinds is totally ignored.  In the second 
mode, cancellation would be an exception; nothing more, nothing less.

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



More information about the c++-pthreads mailing list