Source-Changes-HG archive

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

[src/trunk]: src/lib/libpthread Simplify check for TLS definition to not hide...



details:   https://anonhg.NetBSD.org/src/rev/d67d957afd73
branches:  trunk
changeset: 779114:d67d957afd73
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri May 04 12:26:33 2012 +0000

description:
Simplify check for TLS definition to not hide code. Drop it in another
place as it is redundant.

diffstat:

 lib/libpthread/pthread.c     |  12 +++++-------
 lib/libpthread/pthread_int.h |  10 +++++-----
 2 files changed, 10 insertions(+), 12 deletions(-)

diffs (67 lines):

diff -r 82d096a2ef74 -r d67d957afd73 lib/libpthread/pthread.c
--- a/lib/libpthread/pthread.c  Fri May 04 11:48:12 2012 +0000
+++ b/lib/libpthread/pthread.c  Fri May 04 12:26:33 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread.c,v 1.134 2012/04/26 00:21:44 enami Exp $      */
+/*     $NetBSD: pthread.c,v 1.135 2012/05/04 12:26:33 joerg 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.134 2012/04/26 00:21:44 enami Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.135 2012/05/04 12:26:33 joerg Exp $");
 
 #define        __EXPOSE_STACK  1
 
@@ -1301,14 +1301,12 @@
                    4 * pthread__pagesize / 1024);
 
        *newt = &pthread__main;
-#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
-#  ifdef __HAVE___LWP_GETTCB_FAST
+#ifdef __HAVE___LWP_GETTCB_FAST
        pthread__main.pt_tls = __lwp_gettcb_fast();
-#  else
+#else
        pthread__main.pt_tls = _lwp_getprivate();
-#  endif
+#endif
        pthread__main.pt_tls->tcb_pthread = &pthread__main;
-#endif
 }
 
 #ifndef lint
diff -r 82d096a2ef74 -r d67d957afd73 lib/libpthread/pthread_int.h
--- a/lib/libpthread/pthread_int.h      Fri May 04 11:48:12 2012 +0000
+++ b/lib/libpthread/pthread_int.h      Fri May 04 12:26:33 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_int.h,v 1.84 2012/03/12 20:16:52 joerg Exp $   */
+/*     $NetBSD: pthread_int.h,v 1.85 2012/05/04 12:26:33 joerg Exp $   */
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -256,7 +256,10 @@
        } while (/*CONSTCOND*/0)
 
 
-#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
+#if !defined(__HAVE_TLS_VARIANT_I) && !defined(__HAVE_TLS_VARIANT_II)
+#error Either __HAVE_TLS_VARIANT_I or __HAVE_TLS_VARIANT_II must be defined
+#endif
+
 static inline pthread_t __constfunc
 pthread__self(void)
 {
@@ -267,9 +270,6 @@
 #endif
        return (pthread_t)tcb->tcb_pthread;
 }
-#else
-#error Either __HAVE_TLS_VARIANT_I or __HAVE_TLS_VARIANT_II must be defined
-#endif
 
 #define pthread__abort()                                               \
        pthread__assertfunc(__FILE__, __LINE__, __func__, "unreachable")



Home | Main Index | Thread Index | Old Index