pthread_testcancel() has no effect if cancellation is disabled.
Use pthread_testcancel() with pthread_setcanceltype() called with its canceltype set to PTHREAD_CANCEL_DEFERRED. pthread_testcancel() operation is undefined if pthread_setcanceltype()
was called with its canceltype argument set to PTHREAD_CANCEL_ASYNCHRONOUS.
It is possible to kill a thread when it is holding a resource, such as lock or allocated memory. If that thread has not setup a cancellation cleanup handler to release the held resource, the application is "cancel-unsafe". See attributes(5) for a discussion of Cancel-Safety, Deferred-Cancel-Safety, and Asynchronous-Cancel-Safety.
|