Requests the cancellation of a thread.
Threads Library (libpthreads.a)
#include <pthread.h>
int pthread_cancel (thread)
pthread_t thread;
The pthread_cancel subroutine requests the cancellation of the thread thread. The action depends on the cancelability of the target thread:
The cancellation of a thread terminates it safely, using the same termination procedure as the pthread_exit (pthread_exit Subroutine) subroutine.
Item | Description |
---|---|
thread | Specifies the thread to be canceled. |
If successful, the pthread_cancel function returns zero. Otherwise, an error number is returned to indicate the error.
The ptread_cancel function may fail if:
Item | Description |
---|---|
ESRCH | No thread could be found corresponding to that specified by the given thread ID. |
The pthread_cancel function will not return an error code of EINTR.