
19 Aug
2005
19 Aug
'05
12:02 p.m.
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? regards, alexander.