...
This code instead uses the pthread_cancel()
to terminate the thread. The thread continues to run until it reaches a cancellation point. See the second referenced article [MKS] for a list of functions that are cancellation points. If the cancellation type is set to asynchronous, the thread is terminated immediately. However, POSIX only requires the pthread_cancel()
, pthread_setcancelstate()
, and pthread_setcanceltype()
functions to be async-cancel safe. An application that calls other POSIX functions with asynchronous cancellation enabled is non-conforming.
...