diff options
author | deischen <deischen@FreeBSD.org> | 2001-12-16 13:26:44 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2001-12-16 13:26:44 +0000 |
commit | 53a811b4182c5cac8fea82c976a95c6bc9c177ee (patch) | |
tree | 2e071e257e31bc11f6169f2b9a65853254ce8ffb /lib/libpthread/thread | |
parent | 0de7f7c68606037491d40c2b1a2bc70c9958e734 (diff) | |
download | FreeBSD-src-53a811b4182c5cac8fea82c976a95c6bc9c177ee.zip FreeBSD-src-53a811b4182c5cac8fea82c976a95c6bc9c177ee.tar.gz |
When cancelling a thread while in a join operation, do not detach
the target thread of the join operation. This allows the cancelled
thread to detach the target thread in its cancellation handler.
This bug was found by Butenhof's cancel_subcontract test.
Reviewed by: jasone
Diffstat (limited to 'lib/libpthread/thread')
-rw-r--r-- | lib/libpthread/thread/thr_cancel.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/libpthread/thread/thr_cancel.c b/lib/libpthread/thread/thr_cancel.c index 67c1fb4..4c6ca98 100644 --- a/lib/libpthread/thread/thr_cancel.c +++ b/lib/libpthread/thread/thr_cancel.c @@ -65,14 +65,11 @@ _pthread_cancel(pthread_t pthread) case PS_JOIN: /* - * Disconnect the thread from the joinee and - * detach: + * Disconnect the thread from the joinee: */ if (pthread->join_status.thread != NULL) { pthread->join_status.thread->joiner = NULL; - pthread_detach((pthread_t) - pthread->join_status.thread); } pthread->cancelflags |= PTHREAD_CANCELLING; PTHREAD_NEW_STATE(pthread, PS_RUNNING); |