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

Wil Evers wil at bogo.xs4all.nl
Wed Jul 20 21:24:51 UTC 2005


Nathan Myers wrote:

> I hate to contradict Mark, but I think we've made real progress this
> time around (unlike last).  Pace Wil's pessimism, he has proposed 
> a workable design, compatible with standard C++ semantics and the 
> needs of thread coders alike.

However, I believe my suggestion does imply certain requirements on the 
threads library.  Perhaps it's time to list these, so here's model #5 
(Is it really 5?  I think so.)

* Threads are created with cancellation enabled (this is just repeating 
what POSIX says, I think).

* Cancellation is sticky: it causes an irreversible state change in the 
target thread; subsequent cancellations have no further effect.

* A cancellation exception is a normal C++ exception.  In particular, it 
can be caught by a catch (...), and there is no requirement that it must 
be rethrown if caught.

* A thread's cancellation state is only affected by calls to 
pthread_setcancelstate() originating from user code.

- Wil



More information about the c++-pthreads mailing list