Module Name:    src
Committed By:   ad
Date:           Wed Jan 29 17:11:57 UTC 2020

Modified Files:
        src/lib/libpthread: pthread.c

Log Message:
- pthread_join(): remove temporary hack now kernel returns correct errno.

- kill(getpid(), SIGABRT)  ->  _lwp_kill(_lwp_self(), SIGABRT)


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/lib/libpthread/pthread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.161 src/lib/libpthread/pthread.c:1.162
--- src/lib/libpthread/pthread.c:1.161	Wed Jan 29 16:03:44 2020
+++ src/lib/libpthread/pthread.c	Wed Jan 29 17:11:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.161 2020/01/29 16:03:44 kamil Exp $	*/
+/*	$NetBSD: pthread.c,v 1.162 2020/01/29 17:11:57 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.161 2020/01/29 16:03:44 kamil Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.162 2020/01/29 17:11:57 ad Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -719,10 +719,6 @@ pthread_join(pthread_t thread, void **va
 	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);
@@ -1101,8 +1097,7 @@ pthread__assertfunc(const char *file, in
 	    function ? "\"" : "");
 
 	_sys_write(STDERR_FILENO, buf, (size_t)len);
-	(void)kill(getpid(), SIGABRT);
-
+	(void)_lwp_kill(_lwp_self(), SIGABRT);
 	_exit(1);
 }
 
@@ -1137,7 +1132,7 @@ pthread__errorfunc(const char *file, int
 		syslog(LOG_DEBUG | LOG_USER, "%s", buf);
 
 	if (pthread__diagassert & DIAGASSERT_ABORT) {
-		(void)kill(getpid(), SIGABRT);
+		(void)_lwp_kill(_lwp_self(), SIGABRT);
 		_exit(1);
 	}
 }

Reply via email to