Update copyright dates with scripts/update-copyrights.
[glibc.git] / sysdeps / s390 / nptl / bits / pthreadtypes.h
blob1f3bb14abe0cf90e03629a54a7ca0fe45a2e7de0
1 /* Copyright (C) 2003-2015 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #ifndef _BITS_PTHREADTYPES_H
19 #define _BITS_PTHREADTYPES_H 1
21 #include <bits/wordsize.h>
23 #if __WORDSIZE == 64
24 # define __SIZEOF_PTHREAD_ATTR_T 56
25 # define __SIZEOF_PTHREAD_MUTEX_T 40
26 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
27 # define __SIZEOF_PTHREAD_COND_T 48
28 # define __SIZEOF_PTHREAD_CONDATTR_T 4
29 # define __SIZEOF_PTHREAD_RWLOCK_T 56
30 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
31 # define __SIZEOF_PTHREAD_BARRIER_T 32
32 # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
33 #else
34 # define __SIZEOF_PTHREAD_ATTR_T 36
35 # define __SIZEOF_PTHREAD_MUTEX_T 24
36 # define __SIZEOF_PTHREAD_MUTEXATTR_T 4
37 # define __SIZEOF_PTHREAD_COND_T 48
38 # define __SIZEOF_PTHREAD_CONDATTR_T 4
39 # define __SIZEOF_PTHREAD_RWLOCK_T 32
40 # define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
41 # define __SIZEOF_PTHREAD_BARRIER_T 20
42 # define __SIZEOF_PTHREAD_BARRIERATTR_T 4
43 #endif
46 /* Thread identifiers. The structure of the attribute type is not
47 exposed on purpose. */
48 typedef unsigned long int pthread_t;
51 union pthread_attr_t
53 char __size[__SIZEOF_PTHREAD_ATTR_T];
54 long int __align;
56 #ifndef __have_pthread_attr_t
57 typedef union pthread_attr_t pthread_attr_t;
58 # define __have_pthread_attr_t 1
59 #endif
62 #if __WORDSIZE == 64
63 typedef struct __pthread_internal_list
65 struct __pthread_internal_list *__prev;
66 struct __pthread_internal_list *__next;
67 } __pthread_list_t;
68 #else
69 typedef struct __pthread_internal_slist
71 struct __pthread_internal_slist *__next;
72 } __pthread_slist_t;
73 #endif
76 /* Data structures for mutex handling. The structure of the attribute
77 type is not exposed on purpose. */
78 typedef union
80 struct __pthread_mutex_s
82 int __lock;
83 unsigned int __count;
84 int __owner;
85 #if __WORDSIZE == 64
86 unsigned int __nusers;
87 #endif
88 /* KIND must stay at this position in the structure to maintain
89 binary compatibility. */
90 int __kind;
91 #if __WORDSIZE == 64
92 # ifdef ENABLE_LOCK_ELISION
93 short __spins;
94 short __elision;
95 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
96 # define __PTHREAD_SPINS 0, 0
97 # else
98 int __spins;
99 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
100 # define __PTHREAD_SPINS 0
101 # endif
102 __pthread_list_t __list;
103 # define __PTHREAD_MUTEX_HAVE_PREV 1
104 #else
105 unsigned int __nusers;
106 __extension__ union
108 # ifdef ENABLE_LOCK_ELISION
109 struct
111 short __espins;
112 short __elision;
113 } _d;
114 # define __spins _d.__espins
115 # define __elision _d.__elision
116 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
117 # define __PTHREAD_SPINS { 0, 0 }
118 # else
119 int __spins;
120 /* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
121 # define __PTHREAD_SPINS 0
122 # endif
123 __pthread_slist_t __list;
125 #endif
126 } __data;
127 char __size[__SIZEOF_PTHREAD_MUTEX_T];
128 long int __align;
129 } pthread_mutex_t;
132 typedef union
134 char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
135 int __align;
136 } pthread_mutexattr_t;
139 /* Data structure for conditional variable handling. The structure of
140 the attribute type is not exposed on purpose. */
141 typedef union
143 struct
145 int __lock;
146 unsigned int __futex;
147 __extension__ unsigned long long int __total_seq;
148 __extension__ unsigned long long int __wakeup_seq;
149 __extension__ unsigned long long int __woken_seq;
150 void *__mutex;
151 unsigned int __nwaiters;
152 unsigned int __broadcast_seq;
153 } __data;
154 char __size[__SIZEOF_PTHREAD_COND_T];
155 __extension__ long long int __align;
156 } pthread_cond_t;
158 typedef union
160 char __size[__SIZEOF_PTHREAD_CONDATTR_T];
161 int __align;
162 } pthread_condattr_t;
165 /* Keys for thread-specific data */
166 typedef unsigned int pthread_key_t;
169 /* Once-only execution */
170 typedef int pthread_once_t;
173 #if defined __USE_UNIX98 || defined __USE_XOPEN2K
174 /* Data structure for read-write lock variable handling. The
175 structure of the attribute type is not exposed on purpose. */
176 typedef union
178 # if __WORDSIZE == 64
179 struct
181 int __lock;
182 unsigned int __nr_readers;
183 unsigned int __readers_wakeup;
184 unsigned int __writer_wakeup;
185 unsigned int __nr_readers_queued;
186 unsigned int __nr_writers_queued;
187 int __writer;
188 int __shared;
189 unsigned long int __pad1;
190 unsigned long int __pad2;
191 /* FLAGS must stay at this position in the structure to maintain
192 binary compatibility. */
193 unsigned int __flags;
194 } __data;
195 # else
196 struct
198 int __lock;
199 unsigned int __nr_readers;
200 unsigned int __readers_wakeup;
201 unsigned int __writer_wakeup;
202 unsigned int __nr_readers_queued;
203 unsigned int __nr_writers_queued;
204 unsigned char __pad1;
205 unsigned char __pad2;
206 unsigned char __shared;
207 /* FLAGS must stay at this position in the structure to maintain
208 binary compatibility. */
209 unsigned char __flags;
210 int __writer;
211 } __data;
212 # endif
213 char __size[__SIZEOF_PTHREAD_RWLOCK_T];
214 long int __align;
215 } pthread_rwlock_t;
217 #define __PTHREAD_RWLOCK_ELISION_EXTRA 0
219 typedef union
221 char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
222 long int __align;
223 } pthread_rwlockattr_t;
224 #endif
227 #ifdef __USE_XOPEN2K
228 /* POSIX spinlock data type. */
229 typedef volatile int pthread_spinlock_t;
232 /* POSIX barriers data type. The structure of the type is
233 deliberately not exposed. */
234 typedef union
236 char __size[__SIZEOF_PTHREAD_BARRIER_T];
237 long int __align;
238 } pthread_barrier_t;
240 typedef union
242 char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
243 int __align;
244 } pthread_barrierattr_t;
245 #endif
248 #endif /* bits/pthreadtypes.h */