NAME
pthread_setasynccancel - Enables or disables the current
thread's asynchronous cancelability
SYNOPSIS
#include <pthread.h>
int pthread_setasynccancel( 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:
CANCEL_ON Asynchronous cancelability is
enabled.
CANCEL_OFF Asynchronous cancelability is
disabled.
DESCRIPTION
The pthread_setasynccancel() routine enables or disables the current
thread's asynchronous cancelability and returns the previous cancelabil-
ity state to the state parameter.
When general cancelability is set to CANCEL_OFF, a cancel cannot be
delivered to the thread, even if a cancelable routine is called or asyn-
chronous cancelability is enabled. When general cancelability is set to
CANCEL_ON, cancelability depends on the state of the thread's asynchro-
nous cancelability.
When general cancelability is set to CANCEL_ON and asynchronous cancela-
bility is set to CANCEL_OFF, the thread can only receive a cancel at
specific cancellation points (for example, condition waits, thread
joins, and calls to the pthread_testcancel() routine). If both general
cancelability and asynchronous cancelability are set to CANCEL_ON, the
thread can be canceled at any point in its execution.
When a thread is created, the default asynchronous cancelability state
is CANCEL_OFF.
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 previous
state of asynchronous delivery can be restored later by another call to
this routine.
RETURN VALUES
If the function fails, errno may be set to one of the following values:
Return Error Description
___________________________________________________________
CANCEL_ON Asynchronous cancelability was on.
CANCEL_OFF Asynchronous cancelability was off.
-1 [EINVAL] The specified state is not CANCEL_ON
or CANCEL_OFF.
RELATED INFORMATION
FUNCTIONS: pthread_cancel
pthread_setcancel
pthread_testcancel