pthread_setcancelstate() — Set a thread cancelability state format

Standards

Standards / Extensions C or C++ Dependencies

Single UNIX Specification, version 3

both

z/OS V1R7
POSIX(ON)

Format

#define _OPEN_THREADS 2
#include <pthread.h>

int pthread_setcancelstate(int state, int *oldstate);

General description

pthread_setcancelstate() controls whether the thread acts on a cancelation request caused by a call to pthread_cancel(). The old state is stored into the location pointed to by oldstate. The cancelability states can be:

PTHREAD_CANCEL_ENABLE
The thread can be canceled, but is subject to type. The cancelability types can be found in pthread_setcanceltype() — Set a thread cancelability type format.
PTHREAD_CANCEL_DISABLE
The thread cannot be canceled.

Returned value

If successful, pthread_setcancelstate() returns 0. Upon failure, returns the following EINVAL error code:

  • state is an invalid value.

Related information