Allows a thread to request that it or another thread terminate execution.
pthread_cancel(
               thread );
 
Argument         Data Type               Access
thread           opaque pthread_t        read
#includeint pthread_cancel ( pthread_t thread);
The cancellation processing in the target thread runs asychronously with respect to the calling thread returning from pthread_cancel. The target thread cancelability state and type determine when or if the cancellation takes place:
When a cancel is delivered to a thread, termination processing is similar to pthread_exit. For more information about thread termination, see the Thread Termination section of pthread_create.
This routine is preferred in implementing an Ada abort statement and any other language- or software-defined construct for requesting thread cancellation.
The results of this routine are unpredictable if the value specified in thread refers to a thread that does not currently exist.
Return Description0 Successful completion. [EINVAL] The specified thread is invalid. [ESRCH] thread does not specify an existing thread.
pthread_cleanup_pop pthread_cleanup_push pthread_create pthread_exit pthread_join pthread_setcancelstate pthread_setcanceltype pthread_testcancel