pthread_setasynccancel(3-thr) pthread_setasynccancel(3-thr)
NAME
pthreadsetasynccancel - enables or disables the current thread's
asynchronous cancelability
SYNOPSIS
#include <pthread.h>
int pthreadsetasynccancel(int state);
PARAMETERS
state State of asynchronous cancelability set for the calling
thread. On return, receives the prior state of asynchronous
cancelability. Valid values are as follows:
CANCELON Asynchronous cancelability is enabled.
CANCELOFF Asynchronous cancelability is disabled.
DESCRIPTION
The pthreadsetasynccancel() routine enables or disables the current
thread's asynchronous cancelability and returns the previous asynchro-
nous cancelability state.
When general cancelability is set to CANCELOFF, a cancel cannot be
delivered to the thread, even if a cancelable routine is called or
asynchronous cancelability is enabled. When general cancelability is
set to CANCELON, cancelability depends on the state of the thread's
asynchronous cancelability.
When general cancelability is set to CANCELON and asynchronous cance-
lability is set to CANCELOFF, the thread can only receive a cancel at
specific cancellation points (for example, condition waits, thread
joins, and calls to the pthreadtestcancel() routine). If both general
cancelability and asynchronous cancelability are set to CANCELON, the
thread can be canceled at any point in its execution.
When a thread is created, the default asynchronous cancelability state
is CANCELOFF.
If you call this routine to enable asynchronous cancels, call it in a
region of code where asynchronous delivery of cancels is disabled by a
previous call to this routine. Do not call threads routines in regions
of code where asynchronous delivery of cancels is enabled. The previ-
ous state of asynchronous delivery can be restored later by another
call to this routine.
RETURN VALUES
On successful completion, the previous state of asynchronous cancela-
bility is returned. If the function fails, -1 is returned. Following
are the possible return values and the possible corresponding values
(if any) for errno:
Page 1 Reliant UNIX 5.44 Printed 11/98
pthread_setasynccancel(3-thr) pthread_setasynccancel(3-thr)
CANCELON Asynchronous cancelability was on.
CANCELOFF Asynchronous cancelability was off.
EINVAL The specified state is not CANCELON or CANCELOFF.
SEE ALSO
pthreadcancel(3-thr), pthreadsetcancel(3-thr),
pthreadtestcancel(3-thr).
Page 2 Reliant UNIX 5.44 Printed 11/98