NAME
pthread_cancel —
cancel execution of a thread
SYNOPSIS
#include <pthread.h> int pthread_cancel(pthread_t thread);
DESCRIPTION
The pthread_cancel() function requests that thread be canceled. The target threads cancelability state and type determines when the cancellation takes effect. When the cancellation is acted on, the cancellation cleanup handlers for thread are called. When the last cancellation cleanup handler returns, the thread-specific data destructor functions are called for thread . When the last destructor function returns, thread is terminated.
The cancellation processing in the target thread runs asynchronously with respect to the calling thread returning from pthread_cancel().
RETURN VALUE
If successful, the pthread_cancel() function returns zero. Otherwise, an error number is returned to indicate the error.
ERRORS
The pthread_cancel() function may fail if:
- [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].
EXAMPLES
None.
APPLICATION USAGE
None.
FUTURE DIRECTIONS
None.
SEE ALSO
pthread_exit(3) , pthread_join(3) , pthread_setcancelstate(3) , pthread_cond_wait(3) , pthread_cond_timedwait(3) , <pthread.h> .
DERIVATION
Derived from the POSIX Threads Extension (1003.1c-1995)