See pthread_setcancelstate.html