riscv64: implement NPTL/TLS
[uclibc-ng.git] / libpthread / nptl / sysdeps / unix / sysv / linux / aarch64 / bits / pthreadtypes.h
blob67fcee28b5518ad6fcd416f815d81f72dcea59ef
1 /* Copyright (C) 2002-2017 Free Software Foundation, Inc.
3 The GNU C Library is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Lesser General Public
5 License as published by the Free Software Foundation; either
6 version 2.1 of the License, or (at your option) any later version.
8 The GNU C Library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Lesser General Public License for more details.
13 You should have received a copy of the GNU Lesser General Public
14 License along with the GNU C Library; if not, see
15 <http://www.gnu.org/licenses/>. */
17 #ifndef _BITS_PTHREADTYPES_H
18 #define _BITS_PTHREADTYPES_H 1
20 #include <endian.h>
22 #define __SIZEOF_PTHREAD_ATTR_T 64
23 #define __SIZEOF_PTHREAD_MUTEX_T 48
24 #define __SIZEOF_PTHREAD_MUTEXATTR_T 8
25 #define __SIZEOF_PTHREAD_COND_T 48
26 #define __SIZEOF_PTHREAD_COND_COMPAT_T 48
27 #define __SIZEOF_PTHREAD_CONDATTR_T 8
28 #define __SIZEOF_PTHREAD_RWLOCK_T 56
29 #define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
30 #define __SIZEOF_PTHREAD_BARRIER_T 32
31 #define __SIZEOF_PTHREAD_BARRIERATTR_T 8
33 #define __PTHREAD_RWLOCK_INT_FLAGS_SHARED 1
35 /* Thread identifiers. The structure of the attribute type is not
36 exposed on purpose. */
37 typedef unsigned long int pthread_t;
39 union pthread_attr_t
41 char __size[__SIZEOF_PTHREAD_ATTR_T];
42 long int __align;
44 #ifndef __have_pthread_attr_t
45 typedef union pthread_attr_t pthread_attr_t;
46 # define __have_pthread_attr_t 1
47 #endif
49 typedef struct __pthread_internal_list
51 struct __pthread_internal_list *__prev;
52 struct __pthread_internal_list *__next;
53 } __pthread_list_t;
56 /* Data structures for mutex handling. The structure of the attribute
57 type is not exposed on purpose. */
58 typedef union
60 struct __pthread_mutex_s
62 int __lock;
63 unsigned int __count;
64 int __owner;
65 unsigned int __nusers;
66 /* KIND must stay at this position in the structure to maintain
67 binary compatibility with static initializers. */
68 int __kind;
69 int __spins;
70 __pthread_list_t __list;
71 #define __PTHREAD_MUTEX_HAVE_PREV 1
72 } __data;
73 char __size[__SIZEOF_PTHREAD_MUTEX_T];
74 long int __align;
75 } pthread_mutex_t;
77 typedef union
79 char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
80 long int __align;
81 } pthread_mutexattr_t;
83 /* Data structure for conditional variable handling. The structure of
84 the attribute type is not exposed on purpose. */
85 typedef union
87 struct
89 int __lock;
90 unsigned int __futex;
91 __extension__ unsigned long long int __total_seq;
92 __extension__ unsigned long long int __wakeup_seq;
93 __extension__ unsigned long long int __woken_seq;
94 void *__mutex;
95 unsigned int __nwaiters;
96 unsigned int __broadcast_seq;
97 } __data;
98 char __size[__SIZEOF_PTHREAD_COND_T];
99 __extension__ long long int __align;
100 } pthread_cond_t;
102 typedef union
104 char __size[__SIZEOF_PTHREAD_CONDATTR_T];
105 int __align;
106 } pthread_condattr_t;
109 /* Keys for thread-specific data */
110 typedef unsigned int pthread_key_t;
113 /* Once-only execution */
114 typedef int pthread_once_t;
117 #if defined __USE_UNIX98 || defined __USE_XOPEN2K
118 /* Data structure for read-write lock variable handling. The
119 structure of the attribute type is not exposed on purpose. */
120 typedef union
122 struct
124 int __lock;
125 unsigned int __nr_readers;
126 unsigned int __readers_wakeup;
127 unsigned int __writer_wakeup;
128 unsigned int __nr_readers_queued;
129 unsigned int __nr_writers_queued;
130 int __writer;
131 int __shared;
132 unsigned long int __pad1;
133 unsigned long int __pad2;
134 unsigned int __flags;
135 } __data;
136 char __size[__SIZEOF_PTHREAD_RWLOCK_T];
137 long int __align;
138 } pthread_rwlock_t;
140 typedef union
142 char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
143 long int __align;
144 } pthread_rwlockattr_t;
145 #endif
148 #ifdef __USE_XOPEN2K
149 /* POSIX spinlock data type. */
150 typedef volatile int pthread_spinlock_t;
153 /* POSIX barriers data type. The structure of the type is
154 deliberately not exposed. */
155 typedef union
157 char __size[__SIZEOF_PTHREAD_BARRIER_T];
158 long int __align;
159 } pthread_barrier_t;
161 typedef union
163 char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
164 int __align;
165 } pthread_barrierattr_t;
166 #endif
168 #endif /* bits/pthreadtypes.h */