summaryrefslogtreecommitdiff
path: root/lib/libc_r/uthread
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-12-20 07:50:09 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2001-12-20 07:50:09 +0000
commitd0fa9a09353caa61fedaf260dc41e5f1431ed931 (patch)
treed7475016d19e1c5a2d52c875efea153bf77884d9 /lib/libc_r/uthread
parentd93be8c9688e767bef95462b658a34d07e878637 (diff)
From FreeBSD:
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.
Diffstat (limited to 'lib/libc_r/uthread')
-rw-r--r--lib/libc_r/uthread/uthread_cancel.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/libc_r/uthread/uthread_cancel.c b/lib/libc_r/uthread/uthread_cancel.c
index 29f3a8edebf..594dce20d5a 100644
--- a/lib/libc_r/uthread/uthread_cancel.c
+++ b/lib/libc_r/uthread/uthread_cancel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_cancel.c,v 1.9 2001/12/19 02:02:52 fgsch Exp $ */
+/* $OpenBSD: uthread_cancel.c,v 1.10 2001/12/20 07:50:08 fgsch Exp $ */
/*
* David Leonard <d@openbsd.org>, 1999. Public domain.
*/
@@ -61,13 +61,11 @@ pthread_cancel(pthread)
case PS_JOIN:
/*
- * Disconnect the thread from the joinee and
- * detach:
+ * Disconnect the thread from the joinee:
*/
- if (pthread->data.thread != NULL) {
- pthread->data.thread->joiner = NULL;
- pthread_detach((pthread_t)
- pthread->data.thread);
+ if (pthread->join_status.thread != NULL) {
+ pthread->join_status.thread->joiner
+ = NULL;
}
pthread->cancelflags |= PTHREAD_CANCELLING;
PTHREAD_NEW_STATE(pthread, PS_RUNNING);