]>
git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/nptl/bits/thread-shared-types.h
1 /* Common threading primitives definitions for both POSIX and C11.
2 Copyright (C) 2017-2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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 <https://www.gnu.org/licenses/>. */
19 #ifndef _THREAD_SHARED_TYPES_H
20 #define _THREAD_SHARED_TYPES_H 1
22 /* Arch-specific definitions. Each architecture must define the following
23 macros to define the expected sizes of pthread data types:
25 __SIZEOF_PTHREAD_ATTR_T - size of pthread_attr_t.
26 __SIZEOF_PTHREAD_MUTEX_T - size of pthread_mutex_t.
27 __SIZEOF_PTHREAD_MUTEXATTR_T - size of pthread_mutexattr_t.
28 __SIZEOF_PTHREAD_COND_T - size of pthread_cond_t.
29 __SIZEOF_PTHREAD_CONDATTR_T - size of pthread_condattr_t.
30 __SIZEOF_PTHREAD_RWLOCK_T - size of pthread_rwlock_t.
31 __SIZEOF_PTHREAD_RWLOCKATTR_T - size of pthread_rwlockattr_t.
32 __SIZEOF_PTHREAD_BARRIER_T - size of pthread_barrier_t.
33 __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t.
35 The additional macro defines any constraint for the lock alignment
36 inside the thread structures:
38 __LOCK_ALIGNMENT - for internal lock/futex usage.
40 Same idea but for the once locking primitive:
42 __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition. */
44 #include <bits/pthreadtypes-arch.h>
47 /* Common definition of pthread_mutex_t. */
49 typedef struct __pthread_internal_list
51 struct __pthread_internal_list
*__prev
;
52 struct __pthread_internal_list
*__next
;
55 typedef struct __pthread_internal_slist
57 struct __pthread_internal_slist
*__next
;
60 /* Arch-specific mutex definitions. A generic implementation is provided
61 by sysdeps/nptl/bits/struct_mutex.h. If required, an architecture
62 can override it by defining:
64 1. struct __pthread_mutex_s (used on both pthread_mutex_t and mtx_t
65 definition). It should contains at least the internal members
66 defined in the generic version.
68 2. __LOCK_ALIGNMENT for any extra attribute for internal lock used with
71 3. The macro __PTHREAD_MUTEX_INITIALIZER used for static initialization.
72 It should initialize the mutex internal flag. */
74 #include <bits/struct_mutex.h>
76 /* Arch-sepecific read-write lock definitions. A generic implementation is
77 provided by struct_rwlock.h. If required, an architecture can override it
80 1. struct __pthread_rwlock_arch_t (used on pthread_rwlock_t definition).
81 It should contain at least the internal members defined in the
84 2. The macro __PTHREAD_RWLOCK_INITIALIZER used for static initialization.
85 It should initialize the rwlock internal type. */
87 #include <bits/struct_rwlock.h>
90 /* Common definition of pthread_cond_t. */
92 struct __pthread_cond_s
96 __extension__
unsigned long long int __wseq
;
105 __extension__
unsigned long long int __g1_start
;
112 unsigned int __g_refs
[2] __LOCK_ALIGNMENT
;
113 unsigned int __g_size
[2];
114 unsigned int __g1_orig_size
;
115 unsigned int __wrefs
;
116 unsigned int __g_signals
[2];
119 #endif /* _THREAD_SHARED_TYPES_H */