aboutsummaryrefslogtreecommitdiff
path: root/lib/libthr/thread/thr_exit.c
diff options
context:
space:
mode:
authorDavid Xu <davidxu@FreeBSD.org>2010-08-17 02:50:12 +0000
committerDavid Xu <davidxu@FreeBSD.org>2010-08-17 02:50:12 +0000
commitcdcffc3f1ca65ddc5d0b30afa493654afd7e895a (patch)
tree017294244146958305f887ce78fb2d0247e4d51f /lib/libthr/thread/thr_exit.c
parent7ba25e6e69cba5eff776e7edaf5b3d04ba28c36d (diff)
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.
Notes
Notes: svn path=/head/; revision=211409
Diffstat (limited to 'lib/libthr/thread/thr_exit.c')
-rw-r--r--lib/libthr/thread/thr_exit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c
index 33a2451a45ae..a875d14a27cb 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();