pthread_setcancelstate()

set cancellation state 

Function


SYNOPSIS

#include <pthread.h>

int pthread_setcancelstate(int state, int *oldstate);


DESCRIPTION

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

PTHREAD_CANCEL_DISABLE  

Cancellation requests are held pending until cancellation is enabled for the thread.

PTHREAD_CANCEL_ENABLE  

Cancellation requests are acted on according to the cancellation type setting for the thread.

The default cancellation state is PTHREAD_CANCEL_ENABLE.

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


PARAMETERS

state 

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

oldstate 

Points to a location where the current cancellation state for the calling thread is returned. This parameter may be NULL if the current state is not required.


RETURN VALUES

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

EINVAL 

state is not a valid thread cancellation state setting.

EFAULT 

oldstate is an invalid pointer.


CONFORMANCE

POSIX P1003.1 (1996)


MULTITHREAD SAFETY LEVEL

MT-safe, async-cancel-safe


PORTING ISSUES

Normal.


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_setcanceltype()


PTC MKS Toolkit 10.4 Documentation Build 39.