summaryrefslogtreecommitdiffstats
path: root/lib/libkse
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2001-12-16 13:26:44 +0000
committerdeischen <deischen@FreeBSD.org>2001-12-16 13:26:44 +0000
commit53a811b4182c5cac8fea82c976a95c6bc9c177ee (patch)
tree2e071e257e31bc11f6169f2b9a65853254ce8ffb /lib/libkse
parent0de7f7c68606037491d40c2b1a2bc70c9958e734 (diff)
downloadFreeBSD-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/libkse')
-rw-r--r--lib/libkse/thread/thr_cancel.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/libkse/thread/thr_cancel.c b/lib/libkse/thread/thr_cancel.c
index 67c1fb4..4c6ca98 100644
--- a/lib/libkse/thread/thr_cancel.c
+++ b/lib/libkse/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);
OpenPOWER on IntegriCloud