Source-Changes-HG archive

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

[src/netbsd-6]: src/lib/libpthread Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/9a9b937a95f2
branches:  netbsd-6
changeset: 774049:9a9b937a95f2
user:      riz <riz%NetBSD.org@localhost>
date:      Mon May 07 03:12:33 2012 +0000

description:
Pull up following revision(s) (requested by enami in ticket #209):
        lib/libpthread/pthread.c: revision 1.134
Store allocated lwpctl state in the thread actually forked,
which is the only thread lives in the child process.
The problem originally reported here:
  https://bugs.ruby-lang.org/issues/6341

diffstat:

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

diffs (50 lines):

diff -r ca7a255832fe -r 9a9b937a95f2 lib/libpthread/pthread.c
--- a/lib/libpthread/pthread.c  Mon May 07 03:10:28 2012 +0000
+++ b/lib/libpthread/pthread.c  Mon May 07 03:12:33 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread.c,v 1.125 2011/10/02 18:18:56 christos Exp $   */
+/*     $NetBSD: pthread.c,v 1.125.4.1 2012/05/07 03:12:33 riz 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.125 2011/10/02 18:18:56 christos Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.125.4.1 2012/05/07 03:12:33 riz Exp $");
 
 #define        __EXPOSE_STACK  1
 
@@ -83,7 +83,6 @@
 
 static pthread_attr_t pthread_default_attr;
 static lwpctl_t pthread__dummy_lwpctl = { .lc_curcpu = LWPCTL_CPU_NONE };
-static pthread_t pthread__first;
 
 enum {
        DIAGASSERT_ABORT =      1<<0,
@@ -231,7 +230,6 @@
        }
 
        /* Tell libc that we're here and it should role-play accordingly. */
-       pthread__first = first;
        pthread_atfork(NULL, NULL, pthread__fork_callback);
        __isthreaded = 1;
 }
@@ -239,13 +237,12 @@
 static void
 pthread__fork_callback(void)
 {
-       struct __pthread_st *self;
+       struct __pthread_st *self = pthread__self();
 
        /* lwpctl state is not copied across fork. */
-       if (_lwp_ctl(LWPCTL_FEATURE_CURCPU, &pthread__first->pt_lwpctl)) {
+       if (_lwp_ctl(LWPCTL_FEATURE_CURCPU, &self->pt_lwpctl)) {
                err(1, "_lwp_ctl");
        }
-       self = pthread__self();
        self->pt_lid = _lwp_self();
 }
 



Home | Main Index | Thread Index | Old Index