summaryrefslogtreecommitdiff
path: root/lib/libpthread/pthread.c
diff options
context:
space:
mode:
authorad <ad@NetBSD.org>2020-01-28 09:23:15 +0000
committerad <ad@NetBSD.org>2020-01-28 09:23:15 +0000
commita8272d2fff2ef79db00b5da9514d0a781cd9374f (patch)
tree4485672d70977a95fbdc9ab4c37a6bba205b0559 /lib/libpthread/pthread.c
parent449888f12854c77276bd50fdea20c88147eb661b (diff)
pthread_join(): add a temporary hack to make lib/libpthread/t_detach pass.
The correct fix is to do this in kernel (I have that change, but it's part of the wider change to index LWPs in a tree).
Diffstat (limited to 'lib/libpthread/pthread.c')
-rw-r--r--lib/libpthread/pthread.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libpthread/pthread.c b/lib/libpthread/pthread.c
index 54e694492d7..735e202d5c1 100644
--- a/lib/libpthread/pthread.c
+++ b/lib/libpthread/pthread.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread.c,v 1.157 2020/01/27 20:50:05 ad Exp $ */
+/* $NetBSD: pthread.c,v 1.158 2020/01/28 09:23:15 ad Exp $ */
/*-
* Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread.c,v 1.157 2020/01/27 20:50:05 ad Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.158 2020/01/28 09:23:15 ad Exp $");
#define __EXPOSE_STACK 1
@@ -713,6 +713,10 @@ pthread_join(pthread_t thread, void **valptr)
if (thread == self)
return EDEADLK;
+ /* XXX temporary - kernel should handle. */
+ if ((thread->pt_flags & PT_FLAG_DETACHED) != 0)
+ return EINVAL;
+
/* IEEE Std 1003.1 says pthread_join() never returns EINTR. */
for (;;) {
pthread__testcancel(self);