A thread may disable cancellation of itself altogether with the
pthread_setcancelstate function. Like pthread_setcanceltype, this affects the calling thread.
- The first argument is PTHREAD_CANCEL_DISABLE to disable cancellation, or PTHREAD_CANCEL_ENABLE to re-enable cancellation.
- The second argument, if not null, points to a variable that will receive the previous cancellation state.
pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL);