Cancels the execution of a thread.
#include <pthread.h> int pthread_cancel ( pthread_t thread);
(IN) Specifies the thread to cancel.
If successful, returns 0; otherwise, returns a nonzero error code:
The pthread_cancel function marks the thread for cancellation, and when the thread reaches a safe cancellation checkpoint, the thread is canceled and then destroyed.
When a thread is canceled depends upon the thread state and type. When the cancellation occurs, the cleanup routines for thread are called. When the last cleanup routine returns, the thread-specific data destructor functions are called for thread. When the last destructor function returns, thread is terminated.