]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/aarch64/nptl/bits/pthreadtypes.h
New pthread rwlock that is more scalable.
[thirdparty/glibc.git] / sysdeps / aarch64 / nptl / bits / pthreadtypes.h
CommitLineData
bfff8b1b 1/* Copyright (C) 2002-2017 Free Software Foundation, Inc.
554066b8
MS
2
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_PTHREADTYPES_H
20#define _BITS_PTHREADTYPES_H 1
21
22#include <endian.h>
23
389d1f1b
SE
24#ifdef __ILP32__
25# define __SIZEOF_PTHREAD_ATTR_T 32
26# define __SIZEOF_PTHREAD_MUTEX_T 32
27# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
28# define __SIZEOF_PTHREAD_COND_T 48
29# define __SIZEOF_PTHREAD_COND_COMPAT_T 48
30# define __SIZEOF_PTHREAD_CONDATTR_T 4
31# define __SIZEOF_PTHREAD_RWLOCK_T 48
32# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
33# define __SIZEOF_PTHREAD_BARRIER_T 20
34# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
35#else
36# define __SIZEOF_PTHREAD_ATTR_T 64
37# define __SIZEOF_PTHREAD_MUTEX_T 48
38# define __SIZEOF_PTHREAD_MUTEXATTR_T 8
39# define __SIZEOF_PTHREAD_COND_T 48
40# define __SIZEOF_PTHREAD_COND_COMPAT_T 48
41# define __SIZEOF_PTHREAD_CONDATTR_T 8
42# define __SIZEOF_PTHREAD_RWLOCK_T 56
43# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
44# define __SIZEOF_PTHREAD_BARRIER_T 32
45# define __SIZEOF_PTHREAD_BARRIERATTR_T 8
46#endif
47
48#define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
554066b8
MS
49
50/* Thread identifiers. The structure of the attribute type is not
51 exposed on purpose. */
52typedef unsigned long int pthread_t;
53
54
55union pthread_attr_t
56{
57 char __size[__SIZEOF_PTHREAD_ATTR_T];
58 long int __align;
59};
60#ifndef __have_pthread_attr_t
61typedef union pthread_attr_t pthread_attr_t;
62# define __have_pthread_attr_t1
63#endif
64
65typedef struct __pthread_internal_list
66{
67 struct __pthread_internal_list *__prev;
68 struct __pthread_internal_list *__next;
69} __pthread_list_t;
70
71
72/* Data structures for mutex handling. The structure of the attribute
73 type is not exposed on purpose. */
74typedef union
75{
76 struct __pthread_mutex_s
77 {
78 int __lock;
79 unsigned int __count;
80 int __owner;
81 unsigned int __nusers;
c74940f2
FW
82 /* KIND must stay at this position in the structure to maintain
83 binary compatibility with static initializers. */
554066b8
MS
84 int __kind;
85 int __spins;
86 __pthread_list_t __list;
87#define __PTHREAD_MUTEX_HAVE_PREV 1
88 } __data;
89 char __size[__SIZEOF_PTHREAD_MUTEX_T];
90 long int __align;
91} pthread_mutex_t;
92
01f8eac2
AZ
93/* Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER. */
94#define __PTHREAD_SPINS 0
95
554066b8
MS
96typedef union
97{
98 char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
99 long int __align;
100} pthread_mutexattr_t;
101
102
103/* Data structure for conditional variable handling. The structure of
104 the attribute type is not exposed on purpose. */
105typedef union
106{
107 struct
108 {
ed19993b
TR
109 __extension__ union
110 {
111 __extension__ unsigned long long int __wseq;
112 struct {
113 unsigned int __low;
114 unsigned int __high;
115 } __wseq32;
116 };
117 __extension__ union
118 {
119 __extension__ unsigned long long int __g1_start;
120 struct {
121 unsigned int __low;
122 unsigned int __high;
123 } __g1_start32;
124 };
125 unsigned int __g_refs[2];
126 unsigned int __g_size[2];
127 unsigned int __g1_orig_size;
128 unsigned int __wrefs;
129 unsigned int __g_signals[2];
554066b8
MS
130 } __data;
131 char __size[__SIZEOF_PTHREAD_COND_T];
ed19993b 132 __extension__ long long int __align;
554066b8
MS
133} pthread_cond_t;
134
135typedef union
136{
137 char __size[__SIZEOF_PTHREAD_CONDATTR_T];
138 int __align;
139} pthread_condattr_t;
140
141
142/* Keys for thread-specific data */
143typedef unsigned int pthread_key_t;
144
145
146/* Once-only execution */
147typedef int pthread_once_t;
148
149
150#if defined __USE_UNIX98 || defined __USE_XOPEN2K
151/* Data structure for read-write lock variable handling. The
152 structure of the attribute type is not exposed on purpose. */
153typedef union
154{
155 struct
156 {
cc25c8b4
TR
157 unsigned int __readers;
158 unsigned int __writers;
159 unsigned int __wrphase_futex;
160 unsigned int __writers_futex;
161 unsigned int __pad3;
162 unsigned int __pad4;
163 int __cur_writer;
554066b8
MS
164 int __shared;
165 unsigned long int __pad1;
166 unsigned long int __pad2;
167 unsigned int __flags;
168 } __data;
169 char __size[__SIZEOF_PTHREAD_RWLOCK_T];
170 long int __align;
171} pthread_rwlock_t;
172
8491ed6d
AK
173#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
174
554066b8
MS
175typedef union
176{
177 char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
178 long int __align;
179} pthread_rwlockattr_t;
180#endif
181
182
183#ifdef __USE_XOPEN2K
184/* POSIX spinlock data type. */
185typedef volatile int pthread_spinlock_t;
186
187
188/* POSIX barriers data type. The structure of the type is
189 deliberately not exposed. */
190typedef union
191{
192 char __size[__SIZEOF_PTHREAD_BARRIER_T];
193 long int __align;
194} pthread_barrier_t;
195
196typedef union
197{
198 char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
199 int __align;
200} pthread_barrierattr_t;
201#endif
202
203#endif /* bits/pthreadtypes.h */