Source-Changes-HG archive

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

[src/trunk]: src/lib/libpthread If TLS support is present, use it for pthread...



details:   https://anonhg.NetBSD.org/src/rev/0a2e4f1347f9
branches:  trunk
changeset: 763287:0a2e4f1347f9
user:      joerg <joerg%NetBSD.org@localhost>
date:      Wed Mar 16 12:39:44 2011 +0000

description:
If TLS support is present, use it for pthread__self(). The
initialisation order is correct in this case as _lwp_setprivate has been
called already by ld.elf_so for dynamic programs or _libc_init for
statically linked ones.

diffstat:

 lib/libpthread/pthread_int.h |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r 5ac6a0704b86 -r 0a2e4f1347f9 lib/libpthread/pthread_int.h
--- a/lib/libpthread/pthread_int.h      Wed Mar 16 11:44:01 2011 +0000
+++ b/lib/libpthread/pthread_int.h      Wed Mar 16 12:39:44 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_int.h,v 1.76 2011/03/09 23:10:06 joerg Exp $   */
+/*     $NetBSD: pthread_int.h,v 1.77 2011/03/16 12:39:44 joerg Exp $   */
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -255,21 +255,19 @@
        } while (/*CONSTCOND*/0)
 
 
-#if 0 && defined(__HAVE___LWP_GETPRIVATE_FAST)
-#  if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
+#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
 static inline pthread_t __constfunc
 pthread__self(void)
 {
-       struct tls_tcb *tcb = __lwp_getprivate_fast()
+       struct tls_tcb *tcb = __lwp_getprivate_fast();
        return (pthread_t)tcb->tcb_pthread;
 }
-#  else
+#elif 0 && defined(__HAVE___LWP_GETPRIVATE_FAST)
 static inline pthread_t __constfunc
 pthread__self(void)
 {
        return (pthread_t)__lwp_getprivate_fast();
 }
-#  endif
 #else
 /* Stack location of pointer to a particular thread */
 extern vaddr_t pthread__mainbase;



Home | Main Index | Thread Index | Old Index