Tweak code a bit to be POSIX compatible, when a cancellation request

is acted upon, or when a thread calls pthread_exit(), the thread first
disables cancellation by setting its cancelability state to
PTHREAD_CANCEL_DISABLE and its cancelability type to
PTHREAD_CANCEL_DEFERRED. The cancelability state remains set to
PTHREAD_CANCEL_DISABLE until the thread has terminated.

It has no effect if a cancellation cleanup handler or thread-specific
data destructor routine changes the cancelability state to
PTHREAD_CANCEL_ENABLE.
This commit is contained in:
David Xu 2010-08-17 02:50:12 +00:00
parent 7ba25e6e69
commit cdcffc3f1c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211409

View File

@ -81,6 +81,8 @@ _pthread_exit(void *status)
/* Flag this thread as exiting. */
curthread->cancelling = 1;
curthread->cancel_enable = 0;
curthread->cancel_async = 0;
_thr_exit_cleanup();