fix pthread_exit from cancellation handler