From a15e545ef66f37cb4075b2593d874dd9485d1703 Mon Sep 17 00:00:00 2001 From: ad Date: Tue, 28 Jan 2020 09:23:15 +0000 Subject: [PATCH] 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). --- lib/libpthread/pthread.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/libpthread/pthread.c b/lib/libpthread/pthread.c index 54e694492d76..735e202d5c19 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 -__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);