pthread_cancel(3-thr) pthread_cancel(3-thr)
NAME
pthreadcancel - allows a thread to request that it or another thread
terminate execution
SYNOPSIS
#include <pthread.h>
int pthreadcancel(pthreadt thread);
PARAMETERS
thread Thread that receives a cancel request.
DESCRIPTION
The pthreadcancel() routine sends a cancel to the specified thread. A
cancel is a mechanism by which a calling thread informs either itself
or the called thread to terminate as quickly as possible. Issuing a
cancel does not guarantee that the canceled thread receives or handles
the cancel. The canceled thread can delay processing the cancel after
receiving it. For instance, if a cancel arrives during an important
operation, the canceled thread can continue if what it is doing cannot
be interrupted at the point where the cancel is requested.
Because of communications delays, the calling thread can only rely on
the fact that a cancel eventually becomes pending in the designated
thread (provided that the thread does not terminate beforehand).
Furthermore, the calling thread has no guarantee that a pending cancel
is to be delivered because delivery is controlled by the designated
thread.
Termination processing when a cancel is delivered to a thread is simi-
lar to pthreadexit(). Outstanding cleanup routines are executed in
the context of the target thread, and a status of -1 is made available
to any threads joining with the target thread.
This routine is preferred in implementing Ada's 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 VALUES
If the function fails, errno may be set to one of the following
values:
EINVAL The specified thread is invalid.
ERSCH The specified thread does not refer to a currently existing
thread.
Page 1 Reliant UNIX 5.44 Printed 11/98
pthread_cancel(3-thr) pthread_cancel(3-thr)
SEE ALSO
pthreadexit(3-thr), pthreadjoin(3-thr),
pthreadsetasynccancel(3-thr), pthreadsetcancel(3-thr),
pthreadtestcancel(3-thr).
Page 2 Reliant UNIX 5.44 Printed 11/98