Set a thread's cancellation state
#include <pthread.h>
int pthread_setcancelstate( int state,
int* oldstate );
libc
The pthread_setcancelstate() function sets the calling thread's cancellation state to state and returns the previous cancellation state in oldstate.
The cancellation state can have the following values:
| Cancellation state | Meaning |
|---|---|
| PTHREAD_CANCEL_DISABLE | Cancellation requests are held pending. |
| PTHREAD_CANCEL_ENABLE | Cancellation requests may be acted on according to the cancellation type, see pthread_setcanceltype(). |
The default cancellation state for a thread is PTHREAD_CANCEL_ENABLE.
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
pthread_cancel(), pthread_setcanceltype(), pthread_testcancel()