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

Wil Evers wil at bogo.xs4all.nl
Wed Jul 20 20:28:58 UTC 2005


Alexander Terekhov wrote:

> Nathan Myers wrote:
> [...]
> 
>>What we're talking about here is mechanisms to control what happens
>>when a thread is already in a cancelled state.  As Wil had proposed,
>>a thread in a C++ program starts out with the cancel state having no
>>effect on any operation.  If the thread turns on some form of response
>>(by constructing one of Wil's objects, however implemented), then at
>>any point within its scope where something is supposed to happen (e.g.
>>a cancellation point), something happens.  Precisely what happens
>>then would depend on what sort of Wil-object is in scope.
> 
> Okay. Suppose I put Wil's "enabler" in each and every "thread-main" and
> that all calls to your "thread-safe" library from "thread-mains" are 
> within cancel-enabled scopes. That would be criminal, right? 

No.  One of the aims of my suggestion is to remove any cancellation 
handling policy from the threads library, and put it in the hands of the 
user instead.

So if you feel that leaving cancellation enabled at all times is 
appropriate, you're free to do just that.  That's risky, but I wouldn't 
call it criminal :-).

- Wil

BTW - as you know, a POSIX thread always starts with cancellation 
enabled, so there is no need to put an enabler in your thread-main.



More information about the c++-pthreads mailing list