Module Name:    src
Committed By:   rmind
Date:           Thu Jul  8 15:13:35 UTC 2010

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

Log Message:
pthread_create: simplify error path slightly.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 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.115 src/lib/libpthread/pthread.c:1.116
--- src/lib/libpthread/pthread.c:1.115	Thu Mar 25 01:15:00 2010
+++ src/lib/libpthread/pthread.c	Thu Jul  8 15:13:35 2010
@@ -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;
 	}
 

Reply via email to