Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libpthread use named initializers
details: https://anonhg.NetBSD.org/src/rev/cd503de20680
branches: trunk
changeset: 346589:cd503de20680
user: christos <christos%NetBSD.org@localhost>
date: Wed Jul 20 19:26:52 2016 +0000
description:
use named initializers
diffstat:
lib/libpthread/pthread_types.h | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
diffs (51 lines):
diff -r 660a1ecbbbef -r cd503de20680 lib/libpthread/pthread_types.h
--- a/lib/libpthread/pthread_types.h Wed Jul 20 18:14:12 2016 +0000
+++ b/lib/libpthread/pthread_types.h Wed Jul 20 19:26:52 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_types.h,v 1.19 2016/07/17 13:49:43 skrll Exp $ */
+/* $NetBSD: pthread_types.h,v 1.20 2016/07/20 19:26:52 christos Exp $ */
/*-
* Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -114,6 +114,9 @@
__pthread_spin_t ptm_errorcheck;
#ifdef __CPU_SIMPLE_LOCK_PAD
uint8_t ptm_pad1[3];
+#define _PTHREAD_MUTEX_PAD(a) .a = { 0, 0, 0 },
+#else
+#define _PTHREAD_MUTEX_PAD(a)
#endif
union {
unsigned char ptm_ceiling;
@@ -131,20 +134,17 @@
#define _PT_MUTEX_MAGIC 0x33330003
#define _PT_MUTEX_DEAD 0xDEAD0003
-#ifdef __CPU_SIMPLE_LOCK_PAD
-#define _PTHREAD_MUTEX_INITIALIZER { _PT_MUTEX_MAGIC, \
- __SIMPLELOCK_UNLOCKED, { 0, 0, 0 }, \
- { 0 }, { 0, 0, 0 }, \
- NULL, NULL, 0, NULL \
- }
-#else
-#define _PTHREAD_MUTEX_INITIALIZER { _PT_MUTEX_MAGIC, \
- __SIMPLELOCK_UNLOCKED, \
- { 0 } , \
- NULL, NULL, 0, NULL \
- }
-#endif /* __CPU_SIMPLE_LOCK_PAD */
-
+#define _PTHREAD_MUTEX_INITIALIZER { \
+ .ptm_magic = _PT_MUTEX_MAGIC, \
+ .ptm_errorcheck = __SIMPLELOCK_UNLOCKED, \
+ _PTHREAD_MUTEX_PAD(ptm_pad1) \
+ .ptm_ceiling = 0, \
+ _PTHREAD_MUTEX_PAD(ptm_pad2) \
+ .ptm_owner = NULL, \
+ .ptm_waiters = NULL, \
+ .ptm_recursed = 0, \
+ .ptm_spare2 = NULL, \
+}
struct __pthread_mutexattr_st {
unsigned int ptma_magic;
Home |
Main Index |
Thread Index |
Old Index