This is why we can't have safe cancellation points
This is why we can't have safe cancellation points
Posted Apr 19, 2016 14:40 UTC (Tue) by mjthayer (guest, #39183)In reply to: This is why we can't have safe cancellation points by luto
Parent article: This is why we can't have safe cancellation points
Another potentially daft idea: have the signal handler do nothing but set the cancel flag, but also have a flag to say when the thread is in a critical code section, that is, about to start a cancellable system call, already (or nearly already) checked the cancel flag and not yet (or only just) exited the system call. Then pthread_cancel() in the library just keeps resending the signal until the critical section flag is cleared again. Not nice, but not much cost for people who don't need cancellation.