1 /* Test of <pthread.h> substitute in C++ mode.
2 Copyright (C) 2019-2021 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program 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
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2019. */
19 #define GNULIB_NAMESPACE gnulib
24 #include "signature.h"
27 /* =========== Thread functions =========== */
29 #if GNULIB_TEST_PTHREAD_THREAD
30 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_create, int,
31 (pthread_t *, const pthread_attr_t *,
32 void * (*) (void*), void *));
35 #if GNULIB_TEST_PTHREAD_THREAD
36 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_attr_init, int, (pthread_attr_t *));
39 #if GNULIB_TEST_PTHREAD_THREAD
40 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_attr_getdetachstate, int,
41 (const pthread_attr_t *, int *));
44 #if GNULIB_TEST_PTHREAD_THREAD
45 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_attr_setdetachstate, int,
46 (pthread_attr_t *, int));
49 #if GNULIB_TEST_PTHREAD_THREAD
50 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_attr_destroy, int,
54 #if GNULIB_TEST_PTHREAD_THREAD
55 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_self, pthread_t, (void));
58 #if GNULIB_TEST_PTHREAD_THREAD
59 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_equal, int, (pthread_t, pthread_t));
62 #if GNULIB_TEST_PTHREAD_THREAD
63 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_detach, int, (pthread_t));
66 #if GNULIB_TEST_PTHREAD_THREAD
67 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_join, int, (pthread_t, void **));
70 #if GNULIB_TEST_PTHREAD_THREAD
71 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_exit, void, (void *));
74 /* =========== Once-only control (initialization) functions =========== */
76 #if GNULIB_TEST_PTHREAD_ONCE
77 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_once, int,
78 (pthread_once_t *, void (*) (void)));
81 /* =========== Mutex functions =========== */
83 #if GNULIB_TEST_PTHREAD_MUTEX
84 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_init, int,
85 (pthread_mutex_t *, const pthread_mutexattr_t *));
88 #if GNULIB_TEST_PTHREAD_MUTEX
89 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_init, int,
90 (pthread_mutexattr_t *));
93 #if GNULIB_TEST_PTHREAD_MUTEX
94 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_gettype, int,
95 (const pthread_mutexattr_t *, int *));
98 #if GNULIB_TEST_PTHREAD_MUTEX
99 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_settype, int,
100 (pthread_mutexattr_t *, int));
103 #if GNULIB_TEST_PTHREAD_MUTEX
104 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_getrobust, int,
105 (const pthread_mutexattr_t *, int *));
108 #if GNULIB_TEST_PTHREAD_MUTEX
109 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_setrobust, int,
110 (pthread_mutexattr_t *, int));
113 #if GNULIB_TEST_PTHREAD_MUTEX
114 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutexattr_destroy, int,
115 (pthread_mutexattr_t *));
118 #if GNULIB_TEST_PTHREAD_MUTEX
119 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_lock, int,
120 (pthread_mutex_t *));
123 #if GNULIB_TEST_PTHREAD_MUTEX
124 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_trylock, int,
125 (pthread_mutex_t *));
128 #if GNULIB_TEST_PTHREAD_MUTEX_TIMEDLOCK
129 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_timedlock, int,
130 (pthread_mutex_t *, const struct timespec *));
133 #if GNULIB_TEST_PTHREAD_MUTEX
134 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_unlock, int,
135 (pthread_mutex_t *));
138 #if GNULIB_TEST_PTHREAD_MUTEX
139 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_mutex_destroy, int,
140 (pthread_mutex_t *));
143 /* =========== Read-write lock functions =========== */
145 #if GNULIB_TEST_PTHREAD_RWLOCK
146 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_init, int,
147 (pthread_rwlock_t *, const pthread_rwlockattr_t *));
150 #if GNULIB_TEST_PTHREAD_RWLOCK
151 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlockattr_init, int,
152 (pthread_rwlockattr_t *));
155 #if GNULIB_TEST_PTHREAD_RWLOCK
156 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlockattr_destroy, int,
157 (pthread_rwlockattr_t *));
160 #if GNULIB_TEST_PTHREAD_RWLOCK
161 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_rdlock, int,
162 (pthread_rwlock_t *));
165 #if GNULIB_TEST_PTHREAD_RWLOCK
166 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_wrlock, int,
167 (pthread_rwlock_t *));
170 #if GNULIB_TEST_PTHREAD_RWLOCK
171 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_tryrdlock, int,
172 (pthread_rwlock_t *));
175 #if GNULIB_TEST_PTHREAD_RWLOCK
176 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_trywrlock, int,
177 (pthread_rwlock_t *));
180 #if GNULIB_TEST_PTHREAD_RWLOCK
181 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_timedrdlock, int,
182 (pthread_rwlock_t *, const struct timespec *));
185 #if GNULIB_TEST_PTHREAD_RWLOCK
186 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_timedwrlock, int,
187 (pthread_rwlock_t *, const struct timespec *));
190 #if GNULIB_TEST_PTHREAD_RWLOCK
191 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_unlock, int,
192 (pthread_rwlock_t *));
195 #if GNULIB_TEST_PTHREAD_RWLOCK
196 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_rwlock_destroy, int,
197 (pthread_rwlock_t *));
200 /* =========== Condition variable functions =========== */
202 #if GNULIB_TEST_PTHREAD_COND
203 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_init, int,
204 (pthread_cond_t *, const pthread_condattr_t *));
207 #if GNULIB_TEST_PTHREAD_COND
208 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_condattr_init, int,
209 (pthread_condattr_t *));
212 #if GNULIB_TEST_PTHREAD_COND
213 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_condattr_destroy, int,
214 (pthread_condattr_t *));
217 #if GNULIB_TEST_PTHREAD_COND
218 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_wait, int,
219 (pthread_cond_t *, pthread_mutex_t *));
222 #if GNULIB_TEST_PTHREAD_COND
223 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_timedwait, int,
224 (pthread_cond_t *, pthread_mutex_t *,
225 const struct timespec *));
228 #if GNULIB_TEST_PTHREAD_COND
229 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_signal, int,
233 #if GNULIB_TEST_PTHREAD_COND
234 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_broadcast, int,
238 #if GNULIB_TEST_PTHREAD_COND
239 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_cond_destroy, int,
243 /* =========== Thread-specific storage functions =========== */
245 #if GNULIB_TEST_PTHREAD_TSS
246 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_key_create, int,
247 (pthread_key_t *, void (*) (void *)));
250 #if GNULIB_TEST_PTHREAD_TSS
251 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_setspecific, int,
252 (pthread_key_t, const void *));
255 #if GNULIB_TEST_PTHREAD_TSS
256 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_getspecific, void *,
260 #if GNULIB_TEST_PTHREAD_TSS
261 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_key_delete, int, (pthread_key_t));
264 /* =========== Spinlock functions =========== */
266 #if GNULIB_TEST_PTHREAD_SPIN
267 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_spin_init, int,
268 (pthread_spinlock_t *, int));
271 #if GNULIB_TEST_PTHREAD_SPIN
272 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_spin_lock, int,
273 (pthread_spinlock_t *));
276 #if GNULIB_TEST_PTHREAD_SPIN
277 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_spin_trylock, int,
278 (pthread_spinlock_t *));
281 #if GNULIB_TEST_PTHREAD_SPIN
282 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_spin_unlock, int,
283 (pthread_spinlock_t *));
286 #if GNULIB_TEST_PTHREAD_SPIN
287 SIGNATURE_CHECK (GNULIB_NAMESPACE::pthread_spin_destroy, int,
288 (pthread_spinlock_t *));