Re: cancellation points report failure
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cancellation points report failure



"Ben Hutchings" <ben.hutchings@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> David Abrahams <dave@xxxxxxxxxxxxxxxxxxxx> wrote:
> <snip> 
>> It seems to me that it should be up to the cancelling thread to decide
>> whether it wants to take drastic measures to ensure that cancellation
>> happens.  The only effective way I can think of to do that is to do
>> allow synchronous cancellation requests with a timeout that forces
>> thread termination if it fails to respond... but I'm sure there are
>> other approaches.
>
> What you seem to be suggesting is to convert a synchronous cancellation
> into an asynchronous cancellation.  I don't see how this can be safe.
> If a calling thread is to be allowed to set a time limit on cancellation
> then I think the time-out action should to be to terminate the process.
> However, I'm not convinced that programmers are generally very good at
> setting time limits.

Of course it's not safe.  That's my point, sort of: if you use
synchronous cancellation, you have to give up on any *guarantee* that
the thread will be cancelled, so we shouldn't be considering measures
that take heroic steps to try to ensure it.  If you want to guarantee
that cancellation happens, you have to do something unsafe.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com