summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread
diff options
context:
space:
mode:
authorfgsch <fgsch@openbsd.org>2002-03-07 22:36:03 +0000
committerfgsch <fgsch@openbsd.org>2002-03-07 22:36:03 +0000
commit1d4de188ca52ee13dba915553dcd5903486237b5 (patch)
tree423b88d0cc77000e99a0cceba119989f31e12935 /lib/libpthread/uthread
parentAdd descriptions of BUS_DMA_READ, BUS_DMA_WRITE, and BUS_DMA_STREAMING (diff)
downloadwireguard-openbsd-1d4de188ca52ee13dba915553dcd5903486237b5.tar.xz
wireguard-openbsd-1d4de188ca52ee13dba915553dcd5903486237b5.zip
From FreeBSD:
Properly clear the status of a join operation if the joining thread is canceled or the joinee is detached.
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r--lib/libpthread/uthread/uthread_cancel.c3
-rw-r--r--lib/libpthread/uthread/uthread_detach.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/libpthread/uthread/uthread_cancel.c b/lib/libpthread/uthread/uthread_cancel.c
index 594dce20d5a..43bf2f90669 100644
--- a/lib/libpthread/uthread/uthread_cancel.c
+++ b/lib/libpthread/uthread/uthread_cancel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_cancel.c,v 1.10 2001/12/20 07:50:08 fgsch Exp $ */
+/* $OpenBSD: uthread_cancel.c,v 1.11 2002/03/07 22:36:03 fgsch Exp $ */
/*
* David Leonard <d@openbsd.org>, 1999. Public domain.
*/
@@ -66,6 +66,7 @@ pthread_cancel(pthread)
if (pthread->join_status.thread != NULL) {
pthread->join_status.thread->joiner
= NULL;
+ pthread->join_status.thread = NULL;
}
pthread->cancelflags |= PTHREAD_CANCELLING;
PTHREAD_NEW_STATE(pthread, PS_RUNNING);
diff --git a/lib/libpthread/uthread/uthread_detach.c b/lib/libpthread/uthread/uthread_detach.c
index 786df9d165c..92d41efedc4 100644
--- a/lib/libpthread/uthread/uthread_detach.c
+++ b/lib/libpthread/uthread/uthread_detach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_detach.c,v 1.7 2001/12/11 00:19:47 fgsch Exp $ */
+/* $OpenBSD: uthread_detach.c,v 1.8 2002/03/07 22:36:03 fgsch Exp $ */
/*
* Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
@@ -66,7 +66,9 @@ pthread_detach(pthread_t pthread)
PTHREAD_NEW_STATE(joiner, PS_RUNNING);
/* Set the return value for the woken thread: */
- joiner->error = ESRCH;
+ joiner->join_status.error = ESRCH;
+ joiner->join_status.ret = NULL;
+ joiner->join_status.thread = NULL;
/*
* Disconnect the joiner from the thread being detached: