Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

pthread_setcanceltype(2) OSS System Calls Reference Manual
NAME
pthread_setcanceltype - Sets the calling thread’s cancelability type
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/zputdll
64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/yputdll
H-series and J-series OSS processes that use the Standard POSIX Threads library:
/G/system/zdllnnn/zsptdll
SYNOPSIS
#include <pthread.h> | #include <spthread.h>
/* pthread.h is required to use POSIX User Thread Model library */
/* spthread.h is required to use Standard POSIX Threads library */
int pthread_setcanceltype(
int type,
int *oldtype);
PARAMETERS
type Specifies the cancelability type to set for the calling thread. Valid values are:
PTHREAD_CANCEL_DEFERRED
oldtype Receives the previous cancelability type for the calling thread.
DESCRIPTION
This function sets the calling thread’s cancelability type to the value of the type parameter and
returns its previous cancelability type in the oldtype parameter.
When the cancelability state is PTHREAD_CANCEL_DISABLE (see the
pthread_setcancelstate(2) reference page either online or in the Open System Services System
Calls Reference Manual), a cancelation request cannot be delivered to the thread, even if a can-
celable routine is called or the asynchronous cancelability type is enabled.
When the cancelability state is PTHREAD_CANCEL_ENABLE, cancelability depends on the
thread’s cancelability type. If the thread’s cancelability type is
PTHREAD_CANCEL_DEFERRED, the thread can receive a cancelation request only at
specific cancelation points (including condition waits, thread joins, and calls to the
pthread_testcancel() function.)
When a thread is created, the default cancelability type is PTHREAD_CANCEL_DEFERRED.
The cancelability type of PTHREAD_CANCEL_ASYNCHRONOUS is not supported in this
implementation.
On systems running H06.21 or later H-series RVUs or J06.10 or later J-series RVUs, you can use
either the POSIX User Thread Model library or the Standard POSIX Threads library for threaded
applications.
To use this function in a threaded application that uses the POSIX User Thread Model library on
systems running H06.21 or later RVUs or J06.10 or later RVUs, you must perform all of the fol-
lowing tasks:
Include the pthread.h header file in the application.
Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
5168 Hewlett-Packard Company 527186-023