Sets the calling thread's cancelability state.
Threads Library (libpthreads.a)
#include <pthread.h> int pthread_setcancelstate (state, oldstate) int state; int *oldstate; int pthread_setcanceltype (type, oldtype) int type; int *oldtype; int pthread_testcancel (void)
The pthread_setcancelstate subroutine atomically both sets the calling thread's cancelability state to the indicated state and returns the previous cancelability state at the location referenced by oldstate. Legal values for state are PTHREAD_CANCEL_ENABLE and PTHREAD_CANCEL_DISABLE.
The pthread_setcanceltype subroutine atomically both sets the calling thread's cancelability type to the indicated type and returns the previous cancelability type at the location referenced by oldtype. Legal values for type are PTHREAD_CANCEL_DEFERRED and PTHREAD_CANCEL_ASYNCHRONOUS.
The cancelability state and type of any newly created threads, including the thread in which main was first invoked, are PTHREAD_CANCEL_ENABLE and PTHREAD_CANCEL_DEFERRED respectively.
The pthread_testcancel subroutine creates a cancellation point in the calling thread. The pthread_testcancel subroutine has no effect if cancelability is disabled.
If successful, the pthread_setcancelstate and pthread_setcanceltype subroutines return zero. Otherwise, an error number is returned to indicate the error.
The pthread_setcancelstate subroutine will fail if:
EINVAL | The specified state is not PTHREAD_CANCEL_ENABLE or PTHREAD_CANCEL_DISABLE. |
The pthread_setcanceltype subroutine will fail if:
EINVAL | The specified type is not PTHREAD_CANCEL_DEFERRED or PTHREAD_CANCEL_ASYNCHRONOUS. |
These subroutines will not return an error code of EINTR.
The pthread_cancel (pthread_cancel Subroutine) subroutine.
The pthread.h file.
Terminating Threads in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
Threads Library Quick Reference in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.