Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread pthread_create: simplify error path slightly.



details:   https://anonhg.NetBSD.org/src/rev/e2d0c1c218a5
branches:  trunk
changeset: 756193:e2d0c1c218a5
user:      rmind <rmind%NetBSD.org@localhost>
date:      Thu Jul 08 15:13:35 2010 +0000

description:
pthread_create: simplify error path slightly.

diffstat:

 lib/libpthread/pthread.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (33 lines):

diff -r c83d240bd62d -r e2d0c1c218a5 lib/libpthread/pthread.c
--- a/lib/libpthread/pthread.c  Thu Jul 08 14:51:14 2010 +0000
+++ b/lib/libpthread/pthread.c  Thu Jul 08 15:13:35 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread.c,v 1.115 2010/03/25 01:15:00 explorer Exp $   */
+/*     $NetBSD: pthread.c,v 1.116 2010/07/08 15:13:35 rmind Exp $      */
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread.c,v 1.115 2010/03/25 01:15:00 explorer Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.116 2010/07/08 15:13:35 rmind Exp $");
 
 #define        __EXPOSE_STACK  1
 
@@ -415,11 +415,9 @@
                flag |= LWP_SUSPENDED;
        ret = _lwp_create(&newthread->pt_uc, flag, &newthread->pt_lid);
        if (ret != 0) {
-               free(name);
-               newthread->pt_state = PT_STATE_DEAD;
-               pthread_mutex_lock(&pthread__deadqueue_lock);
-               PTQ_INSERT_HEAD(&pthread__deadqueue, newthread, pt_deadq);
-               pthread_mutex_unlock(&pthread__deadqueue_lock);
+               pthread_mutex_lock(&newthread->pt_lock);
+               /* Will unlock and free name. */
+               pthread__reap(newthread);
                return ret;
        }
 



Home | Main Index | Thread Index | Old Index