Source-Changes-HG archive

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

[src/trunk]: src/lib/libpthread fix the pthread pt_lid in the fork callback f...



details:   https://anonhg.NetBSD.org/src/rev/0a86ef56defa
branches:  trunk
changeset: 753378:0a86ef56defa
user:      explorer <explorer%NetBSD.org@localhost>
date:      Thu Mar 25 01:15:00 2010 +0000

description:
fix the pthread pt_lid in the fork callback function that runs in the child instead of a function that may be going away.  KNFify

diffstat:

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

diffs (42 lines):

diff -r ad435ccce975 -r 0a86ef56defa lib/libpthread/pthread.c
--- a/lib/libpthread/pthread.c  Wed Mar 24 20:52:39 2010 +0000
+++ b/lib/libpthread/pthread.c  Thu Mar 25 01:15:00 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread.c,v 1.114 2010/03/24 07:27:22 explorer Exp $   */
+/*     $NetBSD: pthread.c,v 1.115 2010/03/25 01:15:00 explorer 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.114 2010/03/24 07:27:22 explorer Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.115 2010/03/25 01:15:00 explorer Exp $");
 
 #define        __EXPOSE_STACK  1
 
@@ -235,11 +235,14 @@
 static void
 pthread__fork_callback(void)
 {
+       struct __pthread_st *self;
 
        /* lwpctl state is not copied across fork. */
        if (_lwp_ctl(LWPCTL_FEATURE_CURCPU, &pthread__first->pt_lwpctl)) {
                err(1, "_lwp_ctl");
        }
+       self = pthread__self();
+       self->pt_lid = _lwp_self();
 }
 
 static void
@@ -256,8 +259,6 @@
         * much. Anything that permits some pthread_* calls to work is
         * merely being polite.
         */
-       struct __pthread_st *self = pthread_self();
-       self->pt_lid = _lwp_self();
        pthread__started = 0;
 }
 



Home | Main Index | Thread Index | Old Index