Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pthread_setcanceltype(3) [osf1 man page]

pthread_setcanceltype(3)				     Library Functions Manual					  pthread_setcanceltype(3)

NAME
pthread_setcanceltype - Sets the current thread's cancelability type. LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so) SYNOPSIS
#include <pthread.h> int pthread_setcanceltype( int type, int *oldtype); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: IEEE Std 1003.1c-1995, POSIX System Application Program Interface PARAMETERS
The cancelability type to set for the calling thread. The following are valid values: PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_ASYNCHRONOUS The previous cancelability type. DESCRIPTION
This routine sets the cancelability type and returns the previous type in oldtype. When the cancelability state is set to PTHREAD_CANCEL_DISABLE, (see pthread_setcancelstate), a cancel cannot be delivered to the thread, even if a cancelable routine is called or asynchronous cancelability type is enabled. When the cancelability state is set to PTHREAD_CANCEL_ENABLE, cancelability depends on the thread's cancelability type. If the thread's cancelability type is set to PTHREAD_CANCEL_DEFERRED, the thread can only receive a cancel at specific cancellation points (including con- dition waits, thread joins, and calls to pthread_testcancel.) If the thread's cancelability type is PTHREAD_CANCEL_ASYNCHRONOUS, the thread can be canceled at any point in its execution. When a thread is created, the default cancelability type is PTHREAD_CANCEL_DEFERRED. Warning If the asynchronous cancelability type is set, do not call any routine unless it is explicitly documented as safe to be called with the asynchronous cancelability type. Note that none of the general run-time libraries and none of the DECthreads libraries are safe except for pthread_setcanceltype, pthread_setcancelstate, and cma_alert_restore. The asynchronous cancelability type should only be used when you have a compute-bound section of code that carries no state and makes no routine calls. RETURN VALUES
On successful completion, this routine returns the previous cancelability type in oldtype. If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows: Successful completion. The specified type is not PTHREAD_CANCEL_DEFERRED or PTHREAD_CANCEL_ASYNCHRONOUS. ERRORS
None RELATED INFORMATION
Functions: pthread_cancel(3), pthread_setcancelstate(3), pthread_testcancel(3) Manuals: Guide to DECthreads and Programmer's Guide delim off pthread_setcanceltype(3)

Check Out this Related Man Page

pthread_setcancelstate(3)				     Library Functions Manual					 pthread_setcancelstate(3)

NAME
pthread_setcancelstate - Sets the calling thread's cancelability state. LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so) SYNOPSIS
#include <pthread.h> int pthread_setcancelstate( int state, int *oldstate); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: IEEE Std 1003.1c-1995, POSIX System Application Program Interface PARAMETERS
State of general cancelability to set for the calling thread. The following are valid cancel state values: PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_DISABLE Previous cancelability state for the calling thread. DESCRIPTION
This routine sets the current thread's cancelability state and returns the calling thread's previous cancelability state in oldstate. When cancelability state is set to PTHREAD_CANCEL_DISABLE, a cancelation request cannot be delivered to the thread, even if a cancelable routine is called or asynchronous cancelability type is enabled. When a thread is created, the default cancelability state is PTHREAD_CANCEL_ENABLE. Possible Problems When Disabling Cancelability The most important use of thread cancelation is to ensure that indefinite wait operations are terminated. For example, a thread that waits on some network connection, which can possibly take days to respond (or might never respond), should be made cancelable. When a thread's cancelability is disabled, no routine in that thread is cancelable. As a result, the user is unable to cancel the opera- tion performed by that thread. When disabling cancelability, be sure that no long waits can occur or that it is necessary for other rea- sons to defer cancelation requests around that particular region of code. RETURN VALUES
On successful completion, this routine returns the calling thread's previous cancelability state in the location specified by the oldstate argument. If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows: Successful completion. The specified state is not PTHREAD_CANCEL_ENABLE or PTHREAD_CANCEL_DISABLE. ERRORS
None RELATED INFORMATION
Functions: pthread_cancel(3), pthread_setcanceltype(3), pthread_testcancel(3) Manuals: Guide to DECthreads and Programmer's Guide delim off pthread_setcancelstate(3)
Man Page