summaryrefslogtreecommitdiff
path: root/lib/libpthread
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-03-07 22:36:04 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>2002-03-07 22:36:04 +0000
commit6e30c72c9f734e2d947b28e3ded9e3ba474df78b (patch)
tree5e1245750e497e32778e00089cddfef99ae5b576 /lib/libpthread
parent83fd7efca1381c9256c2c0512c1dc3e57adccdac (diff)
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')
-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: