[c++-pthreads] Re: FW: RE: Re: I'm Lost

Peter Dimov pdimov at mmltd.net
Wed Mar 8 17:16:47 UTC 2006


Meredith, Alisdair wrote:

>> Subject to cancelability.  In C++ "cancelability" would indicate
>> whether cancellation points can throw (these asynchronously-initiated
>> exceptions).
>
> Sorry to jump into the middle of a good dialog with what might seem an
> irrelevance, but how will these asynchronous exceptions (now being
> re-thrown 'as sychronous') interact with exception specifications?
>
> Badly is my only guess.

The exceptions are not asynchronous.

You have a function

    void f();

that can throw (i.e. it doesn't give the nothrow guarantee). This function 
can throw a cancellation exception, but this is no different from throwing 
some other exception. From the point of view of the caller, nothing changes. 
The function just fails.

If, on the other hand, you have

    void f() throw();

or

    void f() throw( X );

where X is not a base of the cancellation exception, this function won't 
throw a cancellation exception (although it might invoke unexpected() or 
terminate() if it invokes other throwing functions, which now includes 
cancellation points.)

Alexander Terekhov has been proposing a model where cancellation points 
automatically detect that a throw-spec somewhere up the call stack would not 
let a cancellation exception through, and if so, refrain from throwing. But 
this requires a language change. 




More information about the c++-pthreads mailing list