reorganize thread exit code, make pthread_exit call cancellation handlers