PTHREAD_CANCEL(3P) SysV PTHREAD_CANCEL(3P)
NAME
pthread_cancel - Initiates termination of a thread
SYNOPSIS
#include <pthread.h>
int pthread_cancel (thread)
pthread_t thread;
DESCRIPTION
The pthread_cancel function initiates termination processing of the
specified thread. If the target thread has already been canceled, the
termination request is ignored.
The thread argument specifies the ID of the thread to be canceled.
If the general cancelability of the target thread has been disabled, the
termination of the thread is held pending until general cancelability is
reenabled. If general cancelability is enabled and asynchronous
cancelability is enabled, the termination of the target thread begins
immediately. If general cancelability is enabled and aynchronous
cancelability is disabled, termination is held pending until the next
cancellation point.
During termination processing, any outstanding cleanup routines are
executed in the context of the target thread and a status of ((void *)-1)
is made available to any threads joining with the target thread.
NOTES
This interface is based on draft 4 of the IEEE P1003.4a standard, and
will be changed to conform to the final version.
DIAGNOSTICS
Upon successful completion, a value of 0 (zero) is returned. Otherwise,
-1 is returned and errno is set to indicate the error.
ERRORS
If the pthread_cancel function fails, errno may be set to one of the
following values:
[EINVAL] The value specified by thread is invalid.
[ESRCH] The value specified by thread does not refer to an existing
thread.
SEE ALSO
pthread_exit(3P), pthread_setasynccancel(3P), pthread_setcancel(3P),
pthread_join(3P)