From dacd4bd9ca4e4cd8e55b86a5ab91b1e5fbf3b8ca Mon Sep 17 00:00:00 2001 From: ad Date: Wed, 21 Feb 2007 22:25:57 +0000 Subject: Minor optimisation to previous: only check for continued existence of the thread if it was detached. --- lib/libpthread/pthread.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/libpthread') diff --git a/lib/libpthread/pthread.c b/lib/libpthread/pthread.c index 4c25a2d63d6..b2b10a056ac 100644 --- a/lib/libpthread/pthread.c +++ b/lib/libpthread/pthread.c @@ -1,4 +1,4 @@ -/* $NetBSD: pthread.c,v 1.60 2007/02/15 15:39:38 yamt Exp $ */ +/* $NetBSD: pthread.c,v 1.61 2007/02/21 22:25:57 ad Exp $ */ /*- * Copyright (c) 2001, 2002, 2003, 2006 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__RCSID("$NetBSD: pthread.c,v 1.60 2007/02/15 15:39:38 yamt Exp $"); +__RCSID("$NetBSD: pthread.c,v 1.61 2007/02/21 22:25:57 ad Exp $"); #include #include @@ -421,7 +421,8 @@ pthread_create(pthread_t *thread, const pthread_attr_t *attr, newthread = PTQ_FIRST(&pthread__deadqueue); if (newthread != NULL) { #ifndef PTHREAD_SA - if (_lwp_kill(newthread->pt_lid, 0) == 0 || errno != ESRCH) + if ((newthread->pt_flags & PT_FLAG_DETACHED) != 0 && + (_lwp_kill(newthread->pt_lid, 0) == 0 || errno != ESRCH)) newthread = NULL; else #endif -- cgit