From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2005-08-19 07:02:32
Andrey Melnikov wrote:
> > How do you cancel threads?
You use pthread_cancel() and rely on mandatory cancel delivery to
"shall occur" cancellation points. Victim threads shall also be
prepared to "may occur" delivery for optional cancellation points
and async-cancel regions (when cancellation is enabled, of course).
> The explanation in the FAQ doesn't explain the problem in details.
> Here's a brief example:
> bool f1(X x)
> X * y = new X;
> // if f1() is aborted at this point
> // *y won't be deallocated
> delete y;
> return false;
Your f1() is clearly async-cancel-UNSAFE as written. So what?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk