diff options
author | davidxu <davidxu@FreeBSD.org> | 2010-08-17 02:50:12 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2010-08-17 02:50:12 +0000 |
commit | 8eb397b4ca5c1d5b3771ddb9e686ab9986e2fc45 (patch) | |
tree | 017294244146958305f887ce78fb2d0247e4d51f /lib/libthr/thread/thr_exit.c | |
parent | 71f5d949743cba25294b6b169ca73cacc12f77e0 (diff) | |
download | FreeBSD-src-8eb397b4ca5c1d5b3771ddb9e686ab9986e2fc45.zip FreeBSD-src-8eb397b4ca5c1d5b3771ddb9e686ab9986e2fc45.tar.gz |
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.
Diffstat (limited to 'lib/libthr/thread/thr_exit.c')
-rw-r--r-- | lib/libthr/thread/thr_exit.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c index 33a2451..a875d14 100644 --- a/lib/libthr/thread/thr_exit.c +++ b/lib/libthr/thread/thr_exit.c @@ -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(); |