pthread_setcanceltype()

set cancellation type of calling thread 

Function


SYNOPSIS

#include <pthread.h>

int pthread_setcanceltype(int type, int *oldtype);


DESCRIPTION

The pthread_setcanceltype() function atomically sets the calling thread's cancellation type to the specified type and, if oldtype is not NULL, stores the previous cancellation type in oldtype. Valid settings for type include:

PTHREAD_CANCEL_ASYNCHRONOUS  

If cancellation is enabled, cancellation requests are acted on immediately.

PTHREAD_CANCEL_DEFERRED  

If cancellation is enabled, cancellation requests are acted on as soon as the thread reaches a cancellation point.

The default cancellation type is PTHREAD_CANCEL_DEFERRED.

Refer to pthread_cancel() for a more detailed discussion of thread cancellation.


PARAMETERS

type 

Is the new cancellation type for the calling thread; one of the values specified in the DESCRIPTION.

oldtype 

Points to a location in which to return the current cancellation type for the calling thread. This parameter may be NULL if the current type is not required.


RETURN VALUES

On success, pthread_setcanceltype() returns 0. On error, one of the following values is returned:

EINVAL 

type is not a valid thread cancellation state setting.

EFAULT 

oldtype is an invalid pointer.


CONFORMANCE

POSIX P1003.1 (1996)


MULTITHREAD SAFETY LEVEL

MT-safe, async-cancel-safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
pthread_cancel(), pthread_setcancelstate()


PTC MKS Toolkit 10.3 Documentation Build 39.