[c++-pthreads] Re: pthread_cancel and EH: let's try this again
Peter Dimov
pdimov at mmltd.net
Fri Jul 22 21:50:41 UTC 2005
Alexander Terekhov wrote:
> Peter Dimov wrote:
> [...]
>> D. to match POSIX semantics, cancellation points don't throw if
>> there is an unfinished exception.
>
> It actually breaks straight POSIX semantics.
>
> int main() {
> pthread_cancel(pthread_self());
> try { throw 0; } catch(...) { pthread_testcancel(); }
> printf("Never reach this point under straight POSIX.");
> }
Yes, it does change the behavior of such programs. I'm hoping that it
doesn't break them, though, because it only delays the cancellation
exception a while, and there is usually a race between the pthread_cancel
and the pthread_testcancel in real code.
> This probably won't please Tru64 and OpenVMS folk.
The only way to find out is to implement these semantics and see what
happens.
More information about the c++-pthreads
mailing list