pthread_setcancelstate Subroutine



Purpose

Sets the calling thread's cancelability state.

Library

Threads Library (libpthreads.a)

Syntax

#include 

int pthread_setcancelstate (state, oldstate)
int state;
int *oldstate;

Description

The pthread_setcancelstate subroutine sets the calling thread's cancelability
state to state. It also returns the previous cancellability state.
The cancelability state specifies whatever a thread can be canceled.

Note:	The pthread.h header file must be the first included file of
each source file using the threads library.

Parameters

state	Specifies the new cancelability state to set. It must have one
of the following values:

PTHREAD_CANCEL_DISABLE	Disables cancelability; the thread is not cancelable.
Cancellation requests are held pending.

PTHREAD_CANCEL_ENABLE	Enables cancelability; the thread is cancelable,
according to its cancelability type. This is the default value.

oldstate	Points to where the previous cancelability state value will
be stored.

Return Values

Upon successful completion, the previous value of the cancelability
state is returned via the oldstate parameter, and 0 is returned. Otherwise,
an error code is returned.

Error Codes

The pthread_setcancelstate subroutine is unsuccessful if the following
is true:

EINVAL	The value of the state parameter is not valid.

Implementation Specifics

This subroutine is part of the Base Operating System (BOS) Runtime.

Related Information

The pthread_cancel subroutine, pthread_setcanceltype subroutine, pthread_testcancel
subroutine.

Terminating Threads.

Threads Library Quick Reference.