Source-Changes-HG archive

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

[src/trunk]: src/lib/libpthread Don't depend on __CPU_SIMPLE_LOCK_PAD to dete...



details:   https://anonhg.NetBSD.org/src/rev/16f05ab6b458
branches:  trunk
changeset: 339083:16f05ab6b458
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Jun 26 10:05:17 2015 +0000

description:
Don't depend on __CPU_SIMPLE_LOCK_PAD to determine the type of
__cpu_simple_lock_t (because it doesn't).  Instead, use sizeof/alignof
with a struct { uchar[] }.

Fixes problem in previous commit, caught by Nick Hudson.

diffstat:

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

diffs (24 lines):

diff -r f7584492bdda -r 16f05ab6b458 lib/libpthread/pthread_types.h
--- a/lib/libpthread/pthread_types.h    Fri Jun 26 07:31:44 2015 +0000
+++ b/lib/libpthread/pthread_types.h    Fri Jun 26 10:05:17 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_types.h,v 1.14 2015/06/26 01:33:08 pooka Exp $ */
+/*     $NetBSD: pthread_types.h,v 1.15 2015/06/26 10:05:17 pooka Exp $ */
 
 /*-
  * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -89,11 +89,9 @@
  * does not touch the guts of those types, we redefine them as non-volatile
  */
 #ifdef __cplusplus
-# ifdef __CPU_SIMPLE_LOCK_PAD
-#  define __pthread_spin_t unsigned char
-# else
-#  define __pthread_spin_t unsigned int
-# endif
+# define __pthread_spin_t \
+    struct { unsigned char _simplelock[sizeof(__cpu_simple_lock_t)]; } \
+        __aligned(__alignof(__cpu_simple_lock_t))
 # define __pthread_volatile
 #else /* __cplusplus */
 # define __pthread_spin_t pthread_spin_t



Home | Main Index | Thread Index | Old Index