pthread_cancel and EH: let's try this again

Alexander Terekhov terekhov at web.de
Tue Jul 12 16:33:12 UTC 2005


Jason Merrill wrote:
[...]
> Tangent follows:
> ----------------
> WRT scheme #1, various people have wondered why re-asserting cancellation
> in the exception's destructor is necessary.  It's necessary because as I
> said in my first message, if someone specifically told the thread to go
> away, they don't want it to recover, they want it to go away.  The thread
> doesn't get to second-guess that request, it has to go away.  It can take
> arbitrarily long to get around to actually going away, but it can't
> actually decide not to.  

Sure it can. Exception handling aside for a moment, a thread can disable 
cancellation permanently.

>                          It especially can't decide this implicitly, as a
> side-effect of code written to handle exceptions.
> 
> This is also the rationale for choosing not to make cancellation a proper
> exception, which leads to scheme #2.

http://groups.google.de/group/comp.programming.threads/msg/5566e2c89974c3d5
http://groups.google.de/group/comp.programming.threads/msg/302cab27618daf4c

regards,
alexander.




More information about the c++-pthreads mailing list