1
/* Copyright (C) 2005, 2006, 2007 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, write to the Free
16
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19
#ifndef _BITS_PTHREADTYPES_H
20
#define _BITS_PTHREADTYPES_H 1
22
/* Linuxthread type sizes (bytes):
23
sizeof(pthread_attr_t) = 0x24 (36)
24
sizeof(pthread_mutex_t) = 0x30 (48)
25
sizeof(pthread_mutexattr_t) = 0x4 (4)
26
sizeof(pthread_cond_t) = 0x30 (48)
27
= Expanded to 64 bytes in NPTL.
28
sizeof(pthread_cond_compat_t) = 0xc (12)
29
= Did not exist in Linuxthreads.
30
sizeof(pthread_condattr_t) = 0x4 (4)
31
sizeof(pthread_rwlock_t) = 0x40 (64)
32
sizeof(pthread_rwlockattr_t) = 0x8 (8)
33
sizeof(pthread_barrier_t) = 0x30 (48)
34
sizeof(pthread_barrierattr_t) = 0x4 (4) */
36
#define __SIZEOF_PTHREAD_ATTR_T 36
37
#define __SIZEOF_PTHREAD_MUTEX_T 48
38
#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
39
#define __SIZEOF_PTHREAD_COND_T 64
40
#define __SIZEOF_PTHREAD_COND_COMPAT_T 12
41
#define __SIZEOF_PTHREAD_CONDATTR_T 4
42
#define __SIZEOF_PTHREAD_RWLOCK_T 64
43
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
44
#define __SIZEOF_PTHREAD_BARRIER_T 48
45
#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
47
/* Thread identifiers. The structure of the attribute type is not
48
exposed on purpose. */
49
typedef unsigned long int pthread_t;
51
/* Our old basic lock type, listed here for posterity.
52
We needed self-aligning locks for linuxthreads LDCW
53
implementation. For NPTL we use LWS Compare and
54
Exchange to implement primitives. */
56
typedef volatile struct {
58
} __attribute__ ((aligned(16))) __atomic_lock_t;
63
char __size[__SIZEOF_PTHREAD_ATTR_T];
68
typedef struct __pthread_internal_slist
70
struct __pthread_internal_slist *__next;
74
/* Data structures for mutex handling. The structure of the attribute
75
type is not exposed on purpose. */
78
struct __pthread_mutex_s
83
/* KIND must stay at this position in the structure to maintain
84
binary compatibility. */
86
unsigned int __nusers;
90
__pthread_slist_t __list;
93
char __size[__SIZEOF_PTHREAD_MUTEX_T];
99
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
101
} pthread_mutexattr_t;
104
/* Data structure for conditional variable handling. The structure of
105
the attribute type is not exposed on purpose. */
111
unsigned int __futex;
112
__extension__ unsigned long long int __total_seq;
113
__extension__ unsigned long long int __wakeup_seq;
114
__extension__ unsigned long long int __woken_seq;
116
unsigned int __nwaiters;
117
unsigned int __broadcast_seq;
119
char __size[__SIZEOF_PTHREAD_COND_T];
120
__extension__ long long int __align;
125
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
127
} pthread_condattr_t;
130
/* Keys for thread-specific data */
131
typedef unsigned int pthread_key_t;
134
/* Once-only execution */
135
typedef int pthread_once_t;
138
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
139
/* Data structure for read-write lock variable handling. The
140
structure of the attribute type is not exposed on purpose. */
146
unsigned int __nr_readers;
147
unsigned int __readers_wakeup;
148
unsigned int __writer_wakeup;
149
unsigned int __nr_readers_queued;
150
unsigned int __nr_writers_queued;
151
/* FLAGS must stay at this position in the structure to maintain
152
binary compatibility. */
153
unsigned char __pad2;
154
unsigned char __pad1;
155
unsigned char __shared;
156
unsigned char __flags;
159
char __size[__SIZEOF_PTHREAD_RWLOCK_T];
165
char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
167
} pthread_rwlockattr_t;
172
/* POSIX spinlock data type. */
173
typedef volatile int pthread_spinlock_t;
176
/* POSIX barriers data type. The structure of the type is
177
deliberately not exposed. */
180
char __size[__SIZEOF_PTHREAD_BARRIER_T];
186
char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
188
} pthread_barrierattr_t;
192
#endif /* bits/pthreadtypes.h */