Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pthread_setasynccancel(3thr) — Ultrix/UWS 4.5.1 RISC

Media Vault

Software Library

Restoration Projects

Artifacts Sought

pthread_setasynccancel(3thr)

Name

pthread_setasynccancel − Enables or disables the current thread’s asynchronous cancelability. 

Syntax

#include <pthread.h>

int pthread_setasynccancel (state)
int state;

Arguments

state State of asynchronous cancelability to set for the calling thread.  Valid values are as follows:

Value Description
CANCEL_ON Asynchronous cancelability is enabled. 
CANCEL_OFF Asynchronous cancelability is disabled. 

Description

This routine enables or disables the current thread’s asynchronous cancelability and returns the previous cancelability state. 

When general cancelability is set to CANCEL_OFF, 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 CANCEL_ON, cancelability depends on the state of the thread’s asynchronous cancelability.  When general cancelability is set to CANCEL_ON and asynchronous cancelability is set to CANCEL_OFF, the thread can only receive a cancel at specific cancelation points (for example, condition waits, thread joins and calls to pthread_testcancel.) 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 has been disabled by a previous call to this routine. Threads routines should not be called 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

On successful completion, this routine returns the previous state of asynchronous cancelability. 

If an error condition occurs, this routine returns -1 and sets errno to the corresponding error value.  Possible return values are as follows. 

Return Error Description
0 Successful completion. 
-1 [EINVAL] The specified state is not CANCEL_ON or CANCEL_OFF. 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026