I\'m wondering if it is safe to call pthread_cancel()
on a terminated thread. I couldn\'t find any hints in the manual page. Thanks in advance for any hints.
No, it isn't safe to call pthread_cancel() on a thread that has been terminated.
The reason is that the implementation may reuse the thread ID of the terminated thread for another thread and calling "pthread_cancel()" on that TID may trigger the termination on threads that shouldn't be terminated or undefined behaviour.