1 /* Copyright (C) 2003-2014 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>
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
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
46 /* Thread identifiers. The structure of the attribute type is not
47 exposed on purpose. */
48 typedef unsigned long int pthread_t
;
53 char __size
[__SIZEOF_PTHREAD_ATTR_T
];
56 #ifndef __have_pthread_attr_t
57 typedef union pthread_attr_t pthread_attr_t
;
58 # define __have_pthread_attr_t 1
63 typedef struct __pthread_internal_list
65 struct __pthread_internal_list
*__prev
;
66 struct __pthread_internal_list
*__next
;
69 typedef struct __pthread_internal_slist
71 struct __pthread_internal_slist
*__next
;
76 /* Data structures for mutex handling. The structure of the attribute
77 type is not exposed on purpose. */
80 struct __pthread_mutex_s
86 unsigned int __nusers
;
88 /* KIND must stay at this position in the structure to maintain
89 binary compatibility. */
93 __pthread_list_t __list
;
94 # define __PTHREAD_MUTEX_HAVE_PREV 1
96 unsigned int __nusers
;
100 __pthread_slist_t __list
;
104 char __size
[__SIZEOF_PTHREAD_MUTEX_T
];
110 char __size
[__SIZEOF_PTHREAD_MUTEXATTR_T
];
112 } pthread_mutexattr_t
;
115 /* Data structure for conditional variable handling. The structure of
116 the attribute type is not exposed on purpose. */
122 unsigned int __futex
;
123 __extension__
unsigned long long int __total_seq
;
124 __extension__
unsigned long long int __wakeup_seq
;
125 __extension__
unsigned long long int __woken_seq
;
127 unsigned int __nwaiters
;
128 unsigned int __broadcast_seq
;
130 char __size
[__SIZEOF_PTHREAD_COND_T
];
131 __extension__
long long int __align
;
136 char __size
[__SIZEOF_PTHREAD_CONDATTR_T
];
138 } pthread_condattr_t
;
141 /* Keys for thread-specific data */
142 typedef unsigned int pthread_key_t
;
145 /* Once-only execution */
146 typedef int pthread_once_t
;
149 #if defined __USE_UNIX98 || defined __USE_XOPEN2K
150 /* Data structure for read-write lock variable handling. The
151 structure of the attribute type is not exposed on purpose. */
154 # if __WORDSIZE == 64
158 unsigned int __nr_readers
;
159 unsigned int __readers_wakeup
;
160 unsigned int __writer_wakeup
;
161 unsigned int __nr_readers_queued
;
162 unsigned int __nr_writers_queued
;
165 unsigned long int __pad1
;
166 unsigned long int __pad2
;
167 /* FLAGS must stay at this position in the structure to maintain
168 binary compatibility. */
169 unsigned int __flags
;
175 unsigned int __nr_readers
;
176 unsigned int __readers_wakeup
;
177 unsigned int __writer_wakeup
;
178 unsigned int __nr_readers_queued
;
179 unsigned int __nr_writers_queued
;
180 unsigned char __pad1
;
181 unsigned char __pad2
;
182 unsigned char __shared
;
183 /* FLAGS must stay at this position in the structure to maintain
184 binary compatibility. */
185 unsigned char __flags
;
189 char __size
[__SIZEOF_PTHREAD_RWLOCK_T
];
195 char __size
[__SIZEOF_PTHREAD_RWLOCKATTR_T
];
197 } pthread_rwlockattr_t
;
202 /* POSIX spinlock data type. */
203 typedef volatile int pthread_spinlock_t
;
206 /* POSIX barriers data type. The structure of the type is
207 deliberately not exposed. */
210 char __size
[__SIZEOF_PTHREAD_BARRIER_T
];
216 char __size
[__SIZEOF_PTHREAD_BARRIERATTR_T
];
218 } pthread_barrierattr_t
;
222 #endif /* bits/pthreadtypes.h */