pthread_setcancelstate() returns zero after completing successfully. Any other return value indicates that an error occurred. When the following condition occurs, the pthread_setcancelstate() function fails and returns the corresponding value.
EINVAL
Description:The state is not PTHREAD_CANCEL_ENABLE or PTHREAD_CANCEL_DISABLE.