1 /* Implement the most essential subset of POSIX 1003.1-2008 pthread.h.
2 
3    Copyright (C) 2009-2021 Free Software Foundation, Inc.
4 
5    This file is free software: you can redistribute it and/or modify
6    it under the terms of the GNU Lesser General Public License as
7    published by the Free Software Foundation; either version 2.1 of the
8    License, or (at your option) any later version.
9 
10    This file 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
13    GNU Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17 
18 /* Written by Paul Eggert, Glen Lenker, and Bruno Haible.  */
19 
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
24 
25 #if defined _GL_ALREADY_INCLUDING_PTHREAD_H
26 /* Special invocation convention:
27    On Android, we have a sequence of nested includes
28    <pthread.h> -> <time.h> -> <sys/time.h> -> <sys/select.h> ->
29    <signal.h> -> <pthread.h>.
30    In this situation, PTHREAD_COND_INITIALIZER is not yet defined,
31    therefore we should not attempt to define PTHREAD_MUTEX_NORMAL etc.  */
32 
33 #@INCLUDE_NEXT@ @NEXT_PTHREAD_H@
34 
35 #else
36 /* Normal invocation convention.  */
37 
38 #ifndef _@GUARD_PREFIX@_PTHREAD_H_
39 
40 #if @HAVE_PTHREAD_H@
41 
42 # define _GL_ALREADY_INCLUDING_PTHREAD_H
43 
44 /* The include_next requires a split double-inclusion guard.  */
45 # @INCLUDE_NEXT@ @NEXT_PTHREAD_H@
46 
47 # undef _GL_ALREADY_INCLUDING_PTHREAD_H
48 
49 #endif
50 
51 #ifndef _@GUARD_PREFIX@_PTHREAD_H_
52 #define _@GUARD_PREFIX@_PTHREAD_H_
53 
54 #define __need_system_stdlib_h
55 #include <stdlib.h>
56 #undef __need_system_stdlib_h
57 
58 
59 /* The pthreads-win32 <pthread.h> defines a couple of broken macros.  */
60 #undef asctime_r
61 #undef ctime_r
62 #undef gmtime_r
63 #undef localtime_r
64 #undef rand_r
65 #undef strtok_r
66 
67 #include <errno.h>
68 #include <sched.h>
69 #include <sys/types.h>
70 #include <time.h>
71 
72 /* The __attribute__ feature is available in gcc versions 2.5 and later.
73    The attribute __pure__ was added in gcc 2.96.  */
74 #ifndef _GL_ATTRIBUTE_PURE
75 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
76 #  define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
77 # else
78 #  define _GL_ATTRIBUTE_PURE /* empty */
79 # endif
80 #endif
81 
82 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
83 
84 /* The definition of _Noreturn is copied here.  */
85 
86 /* The definition of _GL_ARG_NONNULL is copied here.  */
87 
88 /* The definition of _GL_WARN_ON_USE is copied here.  */
89 
90 /* =========== Thread types and macros =========== */
91 
92 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
93 # if @GNULIB_PTHREAD_THREAD@
94 #  include "windows-thread.h"
95 #  if @HAVE_PTHREAD_T@
96 #   define pthread_t rpl_pthread_t
97 #   define pthread_attr_t rpl_pthread_attr_t
98 #  endif
99 #  if !GNULIB_defined_pthread_thread_types
100 typedef glwthread_thread_t pthread_t;
101 typedef unsigned int pthread_attr_t;
102 #   define GNULIB_defined_pthread_thread_types 1
103 #  endif
104 # else
105 #  if @HAVE_PTHREAD_T@
106 #   define pthread_t rpl_pthread_t
107 #   define pthread_attr_t rpl_pthread_attr_t
108 #  endif
109 #  if !GNULIB_defined_pthread_thread_types
110 typedef int pthread_t;
111 typedef unsigned int pthread_attr_t;
112 #   define GNULIB_defined_pthread_thread_types 1
113 #  endif
114 # endif
115 # undef PTHREAD_CREATE_JOINABLE
116 # undef PTHREAD_CREATE_DETACHED
117 # define PTHREAD_CREATE_JOINABLE 0
118 # define PTHREAD_CREATE_DETACHED 1
119 #else
120 # if !@HAVE_PTHREAD_T@
121 #  if !GNULIB_defined_pthread_thread_types
122 typedef int pthread_t;
123 typedef unsigned int pthread_attr_t;
124 #   define GNULIB_defined_pthread_thread_types 1
125 #  endif
126 # endif
127 # if !@HAVE_PTHREAD_CREATE_DETACHED@
128 #  define PTHREAD_CREATE_JOINABLE 0
129 #  define PTHREAD_CREATE_DETACHED 1
130 # endif
131 #endif
132 
133 /* =========== Once-only control (initialization) types and macros ========== */
134 
135 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
136 # if @GNULIB_PTHREAD_ONCE@
137 #  include "windows-once.h"
138 #  if @HAVE_PTHREAD_T@
139 #   define pthread_once_t rpl_pthread_once_t
140 #  endif
141 #  if !GNULIB_defined_pthread_once_types
142 typedef glwthread_once_t pthread_once_t;
143 #   define GNULIB_defined_pthread_once_types 1
144 #  endif
145 #  undef PTHREAD_ONCE_INIT
146 #  define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT
147 # else
148 #  if @HAVE_PTHREAD_T@
149 #   define pthread_once_t rpl_pthread_once_t
150 #  endif
151 #  if !GNULIB_defined_pthread_once_types
152 typedef int pthread_once_t;
153 #   define GNULIB_defined_pthread_once_types 1
154 #  endif
155 #  undef PTHREAD_ONCE_INIT
156 #  define PTHREAD_ONCE_INIT { 0 }
157 # endif
158 #else
159 # if !@HAVE_PTHREAD_T@
160 #  if !GNULIB_defined_pthread_once_types
161 typedef int pthread_once_t;
162 #   define GNULIB_defined_pthread_once_types 1
163 #  endif
164 #  undef PTHREAD_ONCE_INIT
165 #  define PTHREAD_ONCE_INIT { 0 }
166 # endif
167 #endif
168 
169 /* =========== Mutex types and macros =========== */
170 
171 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
172 # if @GNULIB_PTHREAD_MUTEX@
173 #  include "windows-timedmutex.h"
174 #  include "windows-timedrecmutex.h"
175 #  if @HAVE_PTHREAD_T@
176 #   define pthread_mutex_t rpl_pthread_mutex_t
177 #   define pthread_mutexattr_t rpl_pthread_mutexattr_t
178 #  endif
179 #  if !GNULIB_defined_pthread_mutex_types
180 typedef struct
181         {
182           int type;
183           union
184             {
185               glwthread_timedmutex_t    u_timedmutex;
186               glwthread_timedrecmutex_t u_timedrecmutex;
187             }
188           u;
189         }
190         pthread_mutex_t;
191 typedef unsigned int pthread_mutexattr_t;
192 #   define GNULIB_defined_pthread_mutex_types 1
193 #  endif
194 #  undef PTHREAD_MUTEX_INITIALIZER
195 #  define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } }
196 # else
197 #  if @HAVE_PTHREAD_T@
198 #   define pthread_mutex_t rpl_pthread_mutex_t
199 #   define pthread_mutexattr_t rpl_pthread_mutexattr_t
200 #  endif
201 #  if !GNULIB_defined_pthread_mutex_types
202 typedef int pthread_mutex_t;
203 typedef unsigned int pthread_mutexattr_t;
204 #   define GNULIB_defined_pthread_mutex_types 1
205 #  endif
206 #  undef PTHREAD_MUTEX_INITIALIZER
207 #  define PTHREAD_MUTEX_INITIALIZER { 0 }
208 # endif
209 # undef PTHREAD_MUTEX_DEFAULT
210 # undef PTHREAD_MUTEX_NORMAL
211 # undef PTHREAD_MUTEX_ERRORCHECK
212 # undef PTHREAD_MUTEX_RECURSIVE
213 # define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
214 # define PTHREAD_MUTEX_NORMAL 0
215 # define PTHREAD_MUTEX_ERRORCHECK 1
216 # define PTHREAD_MUTEX_RECURSIVE 2
217 # undef PTHREAD_MUTEX_STALLED
218 # undef PTHREAD_MUTEX_ROBUST
219 # define PTHREAD_MUTEX_STALLED 0
220 # define PTHREAD_MUTEX_ROBUST 1
221 #else
222 # if !@HAVE_PTHREAD_T@
223 #  if !GNULIB_defined_pthread_mutex_types
224 typedef int pthread_mutex_t;
225 typedef unsigned int pthread_mutexattr_t;
226 #   define GNULIB_defined_pthread_mutex_types 1
227 #  endif
228 #  undef PTHREAD_MUTEX_INITIALIZER
229 #  define PTHREAD_MUTEX_INITIALIZER { 0 }
230 # endif
231 # if !@HAVE_PTHREAD_MUTEX_RECURSIVE@
232 #  define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
233 #  define PTHREAD_MUTEX_NORMAL 0
234 #  define PTHREAD_MUTEX_ERRORCHECK 1
235 #  define PTHREAD_MUTEX_RECURSIVE 2
236 # endif
237 # if !@HAVE_PTHREAD_MUTEX_ROBUST@
238 #  define PTHREAD_MUTEX_STALLED 0
239 #  define PTHREAD_MUTEX_ROBUST 1
240 # endif
241 #endif
242 
243 /* =========== Read-write lock types and macros =========== */
244 
245 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
246 # if @GNULIB_PTHREAD_RWLOCK@
247 #  include "windows-timedrwlock.h"
248 #  if @HAVE_PTHREAD_T@
249 #   define pthread_rwlock_t rpl_pthread_rwlock_t
250 #   define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
251 #  endif
252 #  if !GNULIB_defined_pthread_rwlock_types
253 typedef glwthread_timedrwlock_t pthread_rwlock_t;
254 typedef unsigned int pthread_rwlockattr_t;
255 #   define GNULIB_defined_pthread_rwlock_types 1
256 #  endif
257 #  undef PTHREAD_RWLOCK_INITIALIZER
258 #  define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT
259 # else
260 #  if @HAVE_PTHREAD_T@
261 #   define pthread_rwlock_t rpl_pthread_rwlock_t
262 #   define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
263 #  endif
264 #  if !GNULIB_defined_pthread_rwlock_types
265 typedef int pthread_rwlock_t;
266 typedef unsigned int pthread_rwlockattr_t;
267 #   define GNULIB_defined_pthread_rwlock_types 1
268 #  endif
269 #  undef PTHREAD_RWLOCK_INITIALIZER
270 #  define PTHREAD_RWLOCK_INITIALIZER { 0 }
271 # endif
272 #elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_INIT@ /* i.e. PTHREAD_RWLOCK_UNIMPLEMENTED */
273 # if @HAVE_PTHREAD_T@
274 #  define pthread_rwlock_t rpl_pthread_rwlock_t
275 #  define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
276 # endif
277 # if !GNULIB_defined_pthread_rwlock_types
278 typedef struct
279         {
280           pthread_mutex_t lock; /* protects the remaining fields */
281           pthread_cond_t waiting_readers; /* waiting readers */
282           pthread_cond_t waiting_writers; /* waiting writers */
283           unsigned int waiting_writers_count; /* number of waiting writers */
284           int runcount; /* number of readers running, or -1 when a writer runs */
285         }
286         pthread_rwlock_t;
287 typedef unsigned int pthread_rwlockattr_t;
288 #  define GNULIB_defined_pthread_rwlock_types 1
289 # endif
290 # undef PTHREAD_RWLOCK_INITIALIZER
291 # define PTHREAD_RWLOCK_INITIALIZER \
292    { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
293 #else
294 # if @HAVE_PTHREAD_T@
295 #  if !defined PTHREAD_RWLOCK_INITIALIZER && defined PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */
296 #   define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP
297 #  endif
298 # else
299 #  if !GNULIB_defined_pthread_rwlock_types
300 typedef int pthread_rwlock_t;
301 typedef unsigned int pthread_rwlockattr_t;
302 #   define GNULIB_defined_pthread_rwlock_types 1
303 #  endif
304 #  undef PTHREAD_RWLOCK_INITIALIZER
305 #  define PTHREAD_RWLOCK_INITIALIZER { 0 }
306 # endif
307 #endif
308 
309 /* =========== Condition variable types and macros =========== */
310 
311 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
312 # if @GNULIB_PTHREAD_COND@
313 #  include "windows-cond.h"
314 #  if @HAVE_PTHREAD_T@
315 #   define pthread_cond_t rpl_pthread_cond_t
316 #   define pthread_condattr_t rpl_pthread_condattr_t
317 #  endif
318 #  if !GNULIB_defined_pthread_cond_types
319 typedef glwthread_cond_t pthread_cond_t;
320 typedef unsigned int pthread_condattr_t;
321 #   define GNULIB_defined_pthread_cond_types 1
322 #  endif
323 #  undef PTHREAD_COND_INITIALIZER
324 #  define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT
325 # else
326 #  if @HAVE_PTHREAD_T@
327 #   define pthread_cond_t rpl_pthread_cond_t
328 #   define pthread_condattr_t rpl_pthread_condattr_t
329 #  endif
330 #  if !GNULIB_defined_pthread_cond_types
331 typedef int pthread_cond_t;
332 typedef unsigned int pthread_condattr_t;
333 #   define GNULIB_defined_pthread_cond_types 1
334 #  endif
335 #  undef PTHREAD_COND_INITIALIZER
336 #  define PTHREAD_COND_INITIALIZER { 0 }
337 # endif
338 #else
339 # if !@HAVE_PTHREAD_T@
340 #  if !GNULIB_defined_pthread_cond_types
341 typedef int pthread_cond_t;
342 typedef unsigned int pthread_condattr_t;
343 #   define GNULIB_defined_pthread_cond_types 1
344 #  endif
345 #  undef PTHREAD_COND_INITIALIZER
346 #  define PTHREAD_COND_INITIALIZER { 0 }
347 # endif
348 #endif
349 
350 /* =========== Thread-specific storage types and macros =========== */
351 
352 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
353 # if @GNULIB_PTHREAD_TSS@
354 #  include "windows-tls.h"
355 #  if @HAVE_PTHREAD_T@
356 #   define pthread_key_t rpl_pthread_key_t
357 #  endif
358 #  if !GNULIB_defined_pthread_tss_types
359 typedef glwthread_tls_key_t pthread_key_t;
360 #   define GNULIB_defined_pthread_tss_types 1
361 #  endif
362 #  undef PTHREAD_DESTRUCTOR_ITERATIONS
363 #  define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS
364 # else
365 #  if @HAVE_PTHREAD_T@
366 #   define pthread_key_t rpl_pthread_key_t
367 #  endif
368 #  if !GNULIB_defined_pthread_tss_types
369 typedef void ** pthread_key_t;
370 #   define GNULIB_defined_pthread_tss_types 1
371 #  endif
372 #  undef PTHREAD_DESTRUCTOR_ITERATIONS
373 #  define PTHREAD_DESTRUCTOR_ITERATIONS 0
374 # endif
375 #else
376 # if !@HAVE_PTHREAD_T@
377 #  if !GNULIB_defined_pthread_tss_types
378 typedef void ** pthread_key_t;
379 #   define GNULIB_defined_pthread_tss_types 1
380 #  endif
381 #  undef PTHREAD_DESTRUCTOR_ITERATIONS
382 #  define PTHREAD_DESTRUCTOR_ITERATIONS 0
383 # endif
384 #endif
385 
386 /* =========== Spinlock types and macros =========== */
387 
388 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
389 # if @GNULIB_PTHREAD_SPIN@
390 #  include "windows-spin.h"
391 #  if @HAVE_PTHREAD_T@
392 #   define pthread_spinlock_t rpl_pthread_spinlock_t
393 #  endif
394 #  if !GNULIB_defined_pthread_spin_types
395 typedef glwthread_spinlock_t pthread_spinlock_t;
396 #   define GNULIB_defined_pthread_spin_types 1
397 #  endif
398 # else
399 #  if @HAVE_PTHREAD_T@
400 #   define pthread_spinlock_t rpl_pthread_spinlock_t
401 #  endif
402 #  if !GNULIB_defined_pthread_spin_types
403 typedef pthread_mutex_t pthread_spinlock_t;
404 #   define GNULIB_defined_pthread_spin_types 1
405 #  endif
406 # endif
407 # undef PTHREAD_PROCESS_PRIVATE
408 # undef PTHREAD_PROCESS_SHARED
409 # define PTHREAD_PROCESS_PRIVATE 0
410 # define PTHREAD_PROCESS_SHARED 1
411 #else
412 # if !@HAVE_PTHREAD_SPINLOCK_T@
413 /* Approximate spinlocks with mutexes.  */
414 #  if !GNULIB_defined_pthread_spin_types
415 typedef pthread_mutex_t pthread_spinlock_t;
416 #   define GNULIB_defined_pthread_spin_types 1
417 #  endif
418 # endif
419 # if !@HAVE_PTHREAD_PROCESS_SHARED@
420 #  define PTHREAD_PROCESS_PRIVATE 0
421 #  define PTHREAD_PROCESS_SHARED 1
422 # endif
423 #endif
424 
425 /* =========== Other types and macros =========== */
426 
427 #if !@HAVE_PTHREAD_T@
428 # if !GNULIB_defined_other_pthread_types
429 typedef int pthread_barrier_t;
430 typedef unsigned int pthread_barrierattr_t;
431 #  define GNULIB_defined_other_pthread_types 1
432 # endif
433 #endif
434 
435 #if !defined PTHREAD_CANCELED
436 
437 # define PTHREAD_BARRIER_SERIAL_THREAD (-1)
438 
439 # define PTHREAD_CANCEL_DEFERRED 0
440 # define PTHREAD_CANCEL_ASYNCHRONOUS 1
441 
442 # define PTHREAD_CANCEL_ENABLE 0
443 # define PTHREAD_CANCEL_DISABLE 1
444 
445 # define PTHREAD_CANCELED ((void *) -1)
446 
447 # define PTHREAD_INHERIT_SCHED 0
448 # define PTHREAD_EXPLICIT_SCHED 1
449 
450 # define PTHREAD_PRIO_NONE 0
451 # define PTHREAD_PRIO_INHERIT 1
452 # define PTHREAD_PRIO_PROTECT 2
453 
454 # define PTHREAD_SCOPE_SYSTEM 0
455 # define PTHREAD_SCOPE_PROCESS 1
456 
457 #endif
458 
459 /* =========== Thread functions =========== */
460 
461 #if @GNULIB_PTHREAD_THREAD@
462 /* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way.
463    Sigh.  */
464 # if @REPLACE_PTHREAD_CREATE@
465 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
466 #   undef pthread_create
467 #   define pthread_create rpl_pthread_create
468 #  endif
469 _GL_FUNCDECL_RPL (pthread_create, int,
470                   (pthread_t *restrict threadp,
471                    const pthread_attr_t *restrict attr,
472                    void * (*mainfunc) (void *), void *restrict arg)
473                   _GL_ARG_NONNULL ((1, 3)));
474 _GL_CXXALIAS_RPL (pthread_create, int,
475                   (pthread_t *restrict threadp,
476                    const pthread_attr_t *restrict attr,
477                    void * (*mainfunc) (void *), void *restrict arg));
478 # else
479 #  if !@HAVE_PTHREAD_CREATE@
480 _GL_FUNCDECL_SYS (pthread_create, int,
481                   (pthread_t *restrict threadp,
482                    const pthread_attr_t *restrict attr,
483                    void * (*mainfunc) (void *), void *restrict arg)
484                   _GL_ARG_NONNULL ((1, 3)));
485 #  endif
486 _GL_CXXALIAS_SYS_CAST (pthread_create, int,
487                        (pthread_t *restrict threadp,
488                         const pthread_attr_t *restrict attr,
489                         void * (*mainfunc) (void *), void *restrict arg));
490 # endif
491 # if __GLIBC__ >= 2
492 _GL_CXXALIASWARN (pthread_create);
493 # endif
494 #elif defined GNULIB_POSIXCHECK
495 # undef pthread_create
496 # if HAVE_RAW_DECL_PTHREAD_CREATE
497 _GL_WARN_ON_USE (pthread_create, "pthread_create is not portable - "
498                  "use gnulib module pthread-thread for portability");
499 # endif
500 #endif
501 
502 #if @GNULIB_PTHREAD_THREAD@
503 # if @REPLACE_PTHREAD_ATTR_INIT@
504 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
505 #   undef pthread_attr_init
506 #   define pthread_attr_init rpl_pthread_attr_init
507 #  endif
508 _GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr)
509                                           _GL_ARG_NONNULL ((1)));
510 _GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr));
511 # else
512 #  if !@HAVE_PTHREAD_ATTR_INIT@
513 _GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr)
514                                           _GL_ARG_NONNULL ((1)));
515 #  endif
516 _GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr));
517 # endif
518 # if __GLIBC__ >= 2
519 _GL_CXXALIASWARN (pthread_attr_init);
520 # endif
521 #elif defined GNULIB_POSIXCHECK
522 # undef pthread_attr_init
523 # if HAVE_RAW_DECL_PTHREAD_ATTR_INIT
524 _GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is not portable - "
525                  "use gnulib module pthread-thread for portability");
526 # endif
527 #endif
528 
529 #if @GNULIB_PTHREAD_THREAD@
530 # if @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@
531 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
532 #   undef pthread_attr_getdetachstate
533 #   define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
534 #  endif
535 _GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int,
536                   (const pthread_attr_t *attr, int *detachstatep)
537                   _GL_ARG_NONNULL ((1, 2)));
538 _GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int,
539                   (const pthread_attr_t *attr, int *detachstatep));
540 # else
541 #  if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@
542 _GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int,
543                   (const pthread_attr_t *attr, int *detachstatep)
544                   _GL_ARG_NONNULL ((1, 2)));
545 #  endif
546 _GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int,
547                   (const pthread_attr_t *attr, int *detachstatep));
548 # endif
549 # if __GLIBC__ >= 2
550 _GL_CXXALIASWARN (pthread_attr_getdetachstate);
551 # endif
552 #elif defined GNULIB_POSIXCHECK
553 # undef pthread_attr_getdetachstate
554 # if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE
555 _GL_WARN_ON_USE (pthread_attr_getdetachstate, "pthread_attr_getdetachstate is not portable - "
556                  "use gnulib module pthread-thread for portability");
557 # endif
558 #endif
559 
560 #if @GNULIB_PTHREAD_THREAD@
561 # if @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@
562 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
563 #   undef pthread_attr_setdetachstate
564 #   define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
565 #  endif
566 _GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int,
567                   (pthread_attr_t *attr, int detachstate)
568                   _GL_ARG_NONNULL ((1)));
569 _GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int,
570                   (pthread_attr_t *attr, int detachstate));
571 # else
572 #  if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@
573 _GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int,
574                   (pthread_attr_t *attr, int detachstate)
575                   _GL_ARG_NONNULL ((1)));
576 #  endif
577 _GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int,
578                   (pthread_attr_t *attr, int detachstate));
579 # endif
580 # if __GLIBC__ >= 2
581 _GL_CXXALIASWARN (pthread_attr_setdetachstate);
582 # endif
583 #elif defined GNULIB_POSIXCHECK
584 # undef pthread_attr_setdetachstate
585 # if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE
586 _GL_WARN_ON_USE (pthread_attr_setdetachstate, "pthread_attr_setdetachstate is not portable - "
587                  "use gnulib module pthread-thread for portability");
588 # endif
589 #endif
590 
591 #if @GNULIB_PTHREAD_THREAD@
592 # if @REPLACE_PTHREAD_ATTR_DESTROY@
593 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
594 #   undef pthread_attr_destroy
595 #   define pthread_attr_destroy rpl_pthread_attr_destroy
596 #  endif
597 _GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr)
598                                              _GL_ARG_NONNULL ((1)));
599 _GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr));
600 # else
601 #  if !@HAVE_PTHREAD_ATTR_DESTROY@
602 _GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr)
603                                              _GL_ARG_NONNULL ((1)));
604 #  endif
605 _GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr));
606 # endif
607 # if __GLIBC__ >= 2
608 _GL_CXXALIASWARN (pthread_attr_destroy);
609 # endif
610 #elif defined GNULIB_POSIXCHECK
611 # undef pthread_attr_destroy
612 # if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY
613 _GL_WARN_ON_USE (pthread_attr_destroy, "pthread_attr_destroy is not portable - "
614                  "use gnulib module pthread-thread for portability");
615 # endif
616 #endif
617 
618 #if @GNULIB_PTHREAD_THREAD@
619 # if @REPLACE_PTHREAD_SELF@
620 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
621 #   undef pthread_self
622 #   define pthread_self rpl_pthread_self
623 #  endif
624 _GL_FUNCDECL_RPL (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE);
625 _GL_CXXALIAS_RPL (pthread_self, pthread_t, (void));
626 # else
627 #  if !@HAVE_PTHREAD_SELF@
628 _GL_FUNCDECL_SYS (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE);
629 #  endif
630 _GL_CXXALIAS_SYS (pthread_self, pthread_t, (void));
631 # endif
632 # if __GLIBC__ >= 2
633 _GL_CXXALIASWARN (pthread_self);
634 # endif
635 #elif defined GNULIB_POSIXCHECK
636 # undef pthread_self
637 # if HAVE_RAW_DECL_PTHREAD_SELF
638 _GL_WARN_ON_USE (pthread_self, "pthread_self is not portable - "
639                  "use gnulib module pthread-thread for portability");
640 # endif
641 #endif
642 
643 #if @GNULIB_PTHREAD_THREAD@
644 # if @REPLACE_PTHREAD_EQUAL@
645 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
646 #   undef pthread_equal
647 #   define pthread_equal rpl_pthread_equal
648 #  endif
649 _GL_FUNCDECL_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
650 _GL_CXXALIAS_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
651 # else
652 #  if !@HAVE_PTHREAD_EQUAL@
653 _GL_FUNCDECL_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
654 #  endif
655 _GL_CXXALIAS_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
656 # endif
657 # if __GLIBC__ >= 2
658 _GL_CXXALIASWARN (pthread_equal);
659 # endif
660 #elif defined GNULIB_POSIXCHECK
661 # undef pthread_equal
662 # if HAVE_RAW_DECL_PTHREAD_EQUAL
663 _GL_WARN_ON_USE (pthread_equal, "pthread_equal is not portable - "
664                  "use gnulib module pthread-thread for portability");
665 # endif
666 #endif
667 
668 #if @GNULIB_PTHREAD_THREAD@
669 # if @REPLACE_PTHREAD_DETACH@
670 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
671 #   undef pthread_detach
672 #   define pthread_detach rpl_pthread_detach
673 #  endif
674 _GL_FUNCDECL_RPL (pthread_detach, int, (pthread_t thread));
675 _GL_CXXALIAS_RPL (pthread_detach, int, (pthread_t thread));
676 # else
677 #  if !@HAVE_PTHREAD_DETACH@
678 _GL_FUNCDECL_SYS (pthread_detach, int, (pthread_t thread));
679 #  endif
680 _GL_CXXALIAS_SYS (pthread_detach, int, (pthread_t thread));
681 # endif
682 # if __GLIBC__ >= 2
683 _GL_CXXALIASWARN (pthread_detach);
684 # endif
685 #elif defined GNULIB_POSIXCHECK
686 # undef pthread_detach
687 # if HAVE_RAW_DECL_PTHREAD_DETACH
688 _GL_WARN_ON_USE (pthread_detach, "pthread_detach is not portable - "
689                  "use gnulib module pthread-thread for portability");
690 # endif
691 #endif
692 
693 #if @GNULIB_PTHREAD_THREAD@
694 # if @REPLACE_PTHREAD_JOIN@
695 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
696 #   undef pthread_join
697 #   define pthread_join rpl_pthread_join
698 #  endif
699 _GL_FUNCDECL_RPL (pthread_join, int, (pthread_t thread, void **valuep));
700 _GL_CXXALIAS_RPL (pthread_join, int, (pthread_t thread, void **valuep));
701 # else
702 #  if !@HAVE_PTHREAD_JOIN@
703 _GL_FUNCDECL_SYS (pthread_join, int, (pthread_t thread, void **valuep));
704 #  endif
705 _GL_CXXALIAS_SYS (pthread_join, int, (pthread_t thread, void **valuep));
706 # endif
707 # if __GLIBC__ >= 2
708 _GL_CXXALIASWARN (pthread_join);
709 # endif
710 #elif defined GNULIB_POSIXCHECK
711 # undef pthread_join
712 # if HAVE_RAW_DECL_PTHREAD_JOIN
713 _GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - "
714                  "use gnulib module pthread-thread for portability");
715 # endif
716 #endif
717 
718 #if @GNULIB_PTHREAD_THREAD@
719 # if @REPLACE_PTHREAD_EXIT@
720 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
721 #   undef pthread_exit
722 #   define pthread_exit rpl_pthread_exit
723 #  endif
724 _GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value));
725 _GL_CXXALIAS_RPL (pthread_exit, void, (void *value));
726 # else
727 #  if !@HAVE_PTHREAD_EXIT@
728 _GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value));
729 #  endif
730 /* Need to cast because of AIX with xlclang++.  */
731 _GL_CXXALIAS_SYS_CAST (pthread_exit, void, (void *value));
732 # endif
733 # if __GLIBC__ >= 2
734 _GL_CXXALIASWARN (pthread_exit);
735 # endif
736 #elif defined GNULIB_POSIXCHECK
737 # undef pthread_exit
738 # if HAVE_RAW_DECL_PTHREAD_EXIT
739 _GL_WARN_ON_USE (pthread_exit, "pthread_exit is not portable - "
740                  "use gnulib module pthread-thread for portability");
741 # endif
742 #endif
743 
744 /* =========== Once-only control (initialization) functions =========== */
745 
746 #if @GNULIB_PTHREAD_ONCE@
747 # if @REPLACE_PTHREAD_ONCE@
748 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
749 #   undef pthread_once
750 #   define pthread_once rpl_pthread_once
751 #  endif
752 _GL_FUNCDECL_RPL (pthread_once, int,
753                   (pthread_once_t *once_control, void (*initfunction) (void))
754                   _GL_ARG_NONNULL ((1, 2)));
755 _GL_CXXALIAS_RPL (pthread_once, int,
756                   (pthread_once_t *once_control, void (*initfunction) (void)));
757 # else
758 #  if !@HAVE_PTHREAD_ONCE@
759 _GL_FUNCDECL_SYS (pthread_once, int,
760                   (pthread_once_t *once_control, void (*initfunction) (void))
761                    _GL_ARG_NONNULL ((1, 2)));
762 #  endif
763 _GL_CXXALIAS_SYS_CAST (pthread_once, int,
764                        (pthread_once_t *once_control,
765                         void (*initfunction) (void)));
766 # endif
767 # if __GLIBC__ >= 2
768 _GL_CXXALIASWARN (pthread_once);
769 # endif
770 #elif defined GNULIB_POSIXCHECK
771 # undef pthread_once
772 # if HAVE_RAW_DECL_PTHREAD_ONCE
773 _GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - "
774                  "use gnulib module pthread-once for portability");
775 # endif
776 #endif
777 
778 /* =========== Mutex functions =========== */
779 
780 #if @GNULIB_PTHREAD_MUTEX@
781 # if @REPLACE_PTHREAD_MUTEX_INIT@
782 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
783 #   undef pthread_mutex_init
784 #   define pthread_mutex_init rpl_pthread_mutex_init
785 #  endif
786 _GL_FUNCDECL_RPL (pthread_mutex_init, int,
787                   (pthread_mutex_t *restrict mutex,
788                    const pthread_mutexattr_t *restrict attr)
789                   _GL_ARG_NONNULL ((1)));
790 _GL_CXXALIAS_RPL (pthread_mutex_init, int,
791                   (pthread_mutex_t *restrict mutex,
792                    const pthread_mutexattr_t *restrict attr));
793 # else
794 #  if !@HAVE_PTHREAD_MUTEX_INIT@
795 _GL_FUNCDECL_SYS (pthread_mutex_init, int,
796                   (pthread_mutex_t *restrict mutex,
797                    const pthread_mutexattr_t *restrict attr)
798                   _GL_ARG_NONNULL ((1)));
799 #  endif
800 _GL_CXXALIAS_SYS (pthread_mutex_init, int,
801                   (pthread_mutex_t *restrict mutex,
802                    const pthread_mutexattr_t *restrict attr));
803 # endif
804 # if __GLIBC__ >= 2
805 _GL_CXXALIASWARN (pthread_mutex_init);
806 # endif
807 #elif defined GNULIB_POSIXCHECK
808 # undef pthread_mutex_init
809 # if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT
810 _GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init is not portable - "
811                  "use gnulib module pthread-mutex for portability");
812 # endif
813 #endif
814 
815 #if @GNULIB_PTHREAD_MUTEX@
816 # if @REPLACE_PTHREAD_MUTEXATTR_INIT@
817 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
818 #   undef pthread_mutexattr_init
819 #   define pthread_mutexattr_init rpl_pthread_mutexattr_init
820 #  endif
821 _GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)
822                                                _GL_ARG_NONNULL ((1)));
823 _GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
824 # else
825 #  if !@HAVE_PTHREAD_MUTEXATTR_INIT@
826 _GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)
827                                                _GL_ARG_NONNULL ((1)));
828 #  endif
829 _GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
830 # endif
831 # if __GLIBC__ >= 2
832 _GL_CXXALIASWARN (pthread_mutexattr_init);
833 # endif
834 #elif defined GNULIB_POSIXCHECK
835 # undef pthread_mutexattr_init
836 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT
837 _GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable - "
838                  "use gnulib module pthread-mutex for portability");
839 # endif
840 #endif
841 
842 #if @GNULIB_PTHREAD_MUTEX@
843 # if @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@
844 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
845 #   undef pthread_mutexattr_gettype
846 #   define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype
847 #  endif
848 _GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int,
849                   (const pthread_mutexattr_t *restrict attr,
850                    int *restrict typep)
851                   _GL_ARG_NONNULL ((1, 2)));
852 _GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int,
853                   (const pthread_mutexattr_t *restrict attr,
854                    int *restrict typep));
855 # else
856 #  if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@
857 _GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int,
858                   (const pthread_mutexattr_t *restrict attr,
859                    int *restrict typep)
860                   _GL_ARG_NONNULL ((1, 2)));
861 #  endif
862 /* Need to cast, because on FreeBSD the first parameter is
863                         pthread_mutexattr_t *attr.  */
864 _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int,
865                        (const pthread_mutexattr_t *restrict attr,
866                         int *restrict typep));
867 # endif
868 # if __GLIBC__ >= 2
869 _GL_CXXALIASWARN (pthread_mutexattr_gettype);
870 # endif
871 #elif defined GNULIB_POSIXCHECK
872 # undef pthread_mutexattr_gettype
873 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE
874 _GL_WARN_ON_USE (pthread_mutexattr_gettype, "pthread_mutexattr_gettype is not portable - "
875                  "use gnulib module pthread-mutex for portability");
876 # endif
877 #endif
878 
879 #if @GNULIB_PTHREAD_MUTEX@
880 # if @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@
881 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
882 #   undef pthread_mutexattr_settype
883 #   define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
884 #  endif
885 _GL_FUNCDECL_RPL (pthread_mutexattr_settype, int,
886                   (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1)));
887 _GL_CXXALIAS_RPL (pthread_mutexattr_settype, int,
888                   (pthread_mutexattr_t *attr, int type));
889 # else
890 #  if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@
891 _GL_FUNCDECL_SYS (pthread_mutexattr_settype, int,
892                   (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1)));
893 #  endif
894 _GL_CXXALIAS_SYS (pthread_mutexattr_settype, int,
895                   (pthread_mutexattr_t *attr, int type));
896 # endif
897 # if __GLIBC__ >= 2
898 _GL_CXXALIASWARN (pthread_mutexattr_settype);
899 # endif
900 #elif defined GNULIB_POSIXCHECK
901 # undef pthread_mutexattr_settype
902 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE
903 _GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not portable - "
904                  "use gnulib module pthread-mutex for portability");
905 # endif
906 #endif
907 
908 #if @GNULIB_PTHREAD_MUTEX@
909 # if @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@
910 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
911 #   undef pthread_mutexattr_getrobust
912 #   define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust
913 #  endif
914 _GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int,
915                   (const pthread_mutexattr_t *restrict attr,
916                    int *restrict robustp)
917                   _GL_ARG_NONNULL ((1, 2)));
918 _GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int,
919                   (const pthread_mutexattr_t *restrict attr,
920                    int *restrict robustp));
921 # else
922 #  if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@
923 _GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int,
924                   (const pthread_mutexattr_t *restrict attr,
925                    int *restrict robustp)
926                   _GL_ARG_NONNULL ((1, 2)));
927 #  endif
928 /* Need to cast, because on FreeBSD the first parameter is
929                         pthread_mutexattr_t *attr.  */
930 _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int,
931                        (const pthread_mutexattr_t *restrict attr,
932                         int *restrict robustp));
933 # endif
934 # if __GLIBC__ >= 2
935 _GL_CXXALIASWARN (pthread_mutexattr_getrobust);
936 # endif
937 #elif defined GNULIB_POSIXCHECK
938 # undef pthread_mutexattr_getrobust
939 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
940 _GL_WARN_ON_USE (pthread_mutexattr_getrobust, "pthread_mutexattr_getrobust is not portable - "
941                  "use gnulib module pthread-mutex for portability");
942 # endif
943 #endif
944 
945 #if @GNULIB_PTHREAD_MUTEX@
946 # if @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@
947 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
948 #   undef pthread_mutexattr_setrobust
949 #   define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
950 #  endif
951 _GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int,
952                   (pthread_mutexattr_t *attr, int robust)
953                   _GL_ARG_NONNULL ((1)));
954 _GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int,
955                   (pthread_mutexattr_t *attr, int robust));
956 # else
957 #  if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@
958 _GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int,
959                   (pthread_mutexattr_t *attr, int robust)
960                   _GL_ARG_NONNULL ((1)));
961 #  endif
962 _GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int,
963                   (pthread_mutexattr_t *attr, int robust));
964 # endif
965 # if __GLIBC__ >= 2
966 _GL_CXXALIASWARN (pthread_mutexattr_setrobust);
967 # endif
968 #elif defined GNULIB_POSIXCHECK
969 # undef pthread_mutexattr_setrobust
970 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
971 _GL_WARN_ON_USE (pthread_mutexattr_setrobust, "pthread_mutexattr_setrobust is not portable - "
972                  "use gnulib module pthread-mutex for portability");
973 # endif
974 #endif
975 
976 #if @GNULIB_PTHREAD_MUTEX@
977 # if @REPLACE_PTHREAD_MUTEXATTR_DESTROY@
978 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
979 #   undef pthread_mutexattr_destroy
980 #   define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
981 #  endif
982 _GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)
983                                                   _GL_ARG_NONNULL ((1)));
984 _GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
985 # else
986 #  if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@
987 _GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)
988                                                   _GL_ARG_NONNULL ((1)));
989 #  endif
990 _GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
991 # endif
992 # if __GLIBC__ >= 2
993 _GL_CXXALIASWARN (pthread_mutexattr_destroy);
994 # endif
995 #elif defined GNULIB_POSIXCHECK
996 # undef pthread_mutexattr_destroy
997 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY
998 _GL_WARN_ON_USE (pthread_mutexattr_destroy, "pthread_mutexattr_destroy is not portable - "
999                  "use gnulib module pthread-mutex for portability");
1000 # endif
1001 #endif
1002 
1003 #if @GNULIB_PTHREAD_MUTEX@
1004 # if @REPLACE_PTHREAD_MUTEX_LOCK@
1005 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1006 #   undef pthread_mutex_lock
1007 #   define pthread_mutex_lock rpl_pthread_mutex_lock
1008 #  endif
1009 _GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex)
1010                                            _GL_ARG_NONNULL ((1)));
1011 _GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
1012 # else
1013 #  if !@HAVE_PTHREAD_MUTEX_LOCK@
1014 _GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex)
1015                                            _GL_ARG_NONNULL ((1)));
1016 #  endif
1017 _GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
1018 # endif
1019 # if __GLIBC__ >= 2
1020 _GL_CXXALIASWARN (pthread_mutex_lock);
1021 # endif
1022 #elif defined GNULIB_POSIXCHECK
1023 # undef pthread_mutex_lock
1024 # if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
1025 _GL_WARN_ON_USE (pthread_mutex_lock, "pthread_mutex_lock is not portable - "
1026                  "use gnulib module pthread-mutex for portability");
1027 # endif
1028 #endif
1029 
1030 #if @GNULIB_PTHREAD_MUTEX@
1031 # if @REPLACE_PTHREAD_MUTEX_TRYLOCK@
1032 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1033 #   undef pthread_mutex_trylock
1034 #   define pthread_mutex_trylock rpl_pthread_mutex_trylock
1035 #  endif
1036 _GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)
1037                                               _GL_ARG_NONNULL ((1)));
1038 _GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
1039 # else
1040 #  if !@HAVE_PTHREAD_MUTEX_TRYLOCK@
1041 _GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)
1042                                               _GL_ARG_NONNULL ((1)));
1043 #  endif
1044 _GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
1045 # endif
1046 # if __GLIBC__ >= 2
1047 _GL_CXXALIASWARN (pthread_mutex_trylock);
1048 # endif
1049 #elif defined GNULIB_POSIXCHECK
1050 # undef pthread_mutex_trylock
1051 # if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK
1052 _GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - "
1053                  "use gnulib module pthread-mutex for portability");
1054 # endif
1055 #endif
1056 
1057 #if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
1058 # if @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@
1059 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1060 #   undef pthread_mutex_timedlock
1061 #   define pthread_mutex_timedlock rpl_pthread_mutex_timedlock
1062 #  endif
1063 _GL_FUNCDECL_RPL (pthread_mutex_timedlock, int,
1064                   (pthread_mutex_t *restrict mutex,
1065                    const struct timespec *restrict abstime)
1066                   _GL_ARG_NONNULL ((1, 2)));
1067 _GL_CXXALIAS_RPL (pthread_mutex_timedlock, int,
1068                   (pthread_mutex_t *restrict mutex,
1069                    const struct timespec *restrict abstime));
1070 # else
1071 #  if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@
1072 _GL_FUNCDECL_SYS (pthread_mutex_timedlock, int,
1073                   (pthread_mutex_t *restrict mutex,
1074                    const struct timespec *restrict abstime)
1075                   _GL_ARG_NONNULL ((1, 2)));
1076 #  endif
1077 _GL_CXXALIAS_SYS (pthread_mutex_timedlock, int,
1078                   (pthread_mutex_t *restrict mutex,
1079                    const struct timespec *restrict abstime));
1080 # endif
1081 # if __GLIBC__ >= 2
1082 _GL_CXXALIASWARN (pthread_mutex_timedlock);
1083 # endif
1084 #elif defined GNULIB_POSIXCHECK
1085 # undef pthread_mutex_timedlock
1086 # if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK
1087 _GL_WARN_ON_USE (pthread_mutex_timedlock, "pthread_mutex_timedlock is not portable - "
1088                  "use gnulib module pthread_mutex_timedlock for portability");
1089 # endif
1090 #endif
1091 
1092 #if @GNULIB_PTHREAD_MUTEX@
1093 # if @REPLACE_PTHREAD_MUTEX_UNLOCK@
1094 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1095 #   undef pthread_mutex_unlock
1096 #   define pthread_mutex_unlock rpl_pthread_mutex_unlock
1097 #  endif
1098 _GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)
1099                                              _GL_ARG_NONNULL ((1)));
1100 _GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1101 # else
1102 #  if !@HAVE_PTHREAD_MUTEX_UNLOCK@
1103 _GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)
1104                                              _GL_ARG_NONNULL ((1)));
1105 #  endif
1106 _GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1107 # endif
1108 # if __GLIBC__ >= 2
1109 _GL_CXXALIASWARN (pthread_mutex_unlock);
1110 # endif
1111 #elif defined GNULIB_POSIXCHECK
1112 # undef pthread_mutex_unlock
1113 # if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK
1114 _GL_WARN_ON_USE (pthread_mutex_unlock, "pthread_mutex_unlock is not portable - "
1115                  "use gnulib module pthread-mutex for portability");
1116 # endif
1117 #endif
1118 
1119 #if @GNULIB_PTHREAD_MUTEX@
1120 # if @REPLACE_PTHREAD_MUTEX_DESTROY@
1121 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1122 #   undef pthread_mutex_destroy
1123 #   define pthread_mutex_destroy rpl_pthread_mutex_destroy
1124 #  endif
1125 _GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)
1126                                               _GL_ARG_NONNULL ((1)));
1127 _GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1128 # else
1129 #  if !@HAVE_PTHREAD_MUTEX_DESTROY@
1130 _GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)
1131                                               _GL_ARG_NONNULL ((1)));
1132 #  endif
1133 _GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1134 # endif
1135 # if __GLIBC__ >= 2
1136 _GL_CXXALIASWARN (pthread_mutex_destroy);
1137 # endif
1138 #elif defined GNULIB_POSIXCHECK
1139 # undef pthread_mutex_destroy
1140 # if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY
1141 _GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - "
1142                  "use gnulib module pthread-mutex for portability");
1143 # endif
1144 #endif
1145 
1146 /* =========== Read-write lock functions =========== */
1147 
1148 #if @GNULIB_PTHREAD_RWLOCK@
1149 # if @REPLACE_PTHREAD_RWLOCK_INIT@
1150 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1151 #   undef pthread_rwlock_init
1152 #   define pthread_rwlock_init rpl_pthread_rwlock_init
1153 #  endif
1154 _GL_FUNCDECL_RPL (pthread_rwlock_init, int,
1155                   (pthread_rwlock_t *restrict lock,
1156                    const pthread_rwlockattr_t *restrict attr)
1157                   _GL_ARG_NONNULL ((1)));
1158 _GL_CXXALIAS_RPL (pthread_rwlock_init, int,
1159                   (pthread_rwlock_t *restrict lock,
1160                    const pthread_rwlockattr_t *restrict attr));
1161 # else
1162 #  if !@HAVE_PTHREAD_RWLOCK_INIT@
1163 _GL_FUNCDECL_SYS (pthread_rwlock_init, int,
1164                   (pthread_rwlock_t *restrict lock,
1165                    const pthread_rwlockattr_t *restrict attr)
1166                   _GL_ARG_NONNULL ((1)));
1167 #  endif
1168 _GL_CXXALIAS_SYS (pthread_rwlock_init, int,
1169                   (pthread_rwlock_t *restrict lock,
1170                    const pthread_rwlockattr_t *restrict attr));
1171 # endif
1172 # if __GLIBC__ >= 2
1173 _GL_CXXALIASWARN (pthread_rwlock_init);
1174 # endif
1175 #elif defined GNULIB_POSIXCHECK
1176 # undef pthread_rwlock_init
1177 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT
1178 _GL_WARN_ON_USE (pthread_rwlock_init, "pthread_rwlock_init is not portable - "
1179                  "use gnulib module pthread-rwlock for portability");
1180 # endif
1181 #endif
1182 
1183 #if @GNULIB_PTHREAD_RWLOCK@
1184 # if @REPLACE_PTHREAD_RWLOCKATTR_INIT@
1185 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1186 #   undef pthread_rwlockattr_init
1187 #   define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
1188 #  endif
1189 _GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)
1190                                                 _GL_ARG_NONNULL ((1)));
1191 _GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1192 # else
1193 #  if !@HAVE_PTHREAD_RWLOCKATTR_INIT@
1194 _GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)
1195                                                 _GL_ARG_NONNULL ((1)));
1196 #  endif
1197 _GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1198 # endif
1199 # if __GLIBC__ >= 2
1200 _GL_CXXALIASWARN (pthread_rwlockattr_init);
1201 # endif
1202 #elif defined GNULIB_POSIXCHECK
1203 # undef pthread_rwlockattr_init
1204 # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT
1205 _GL_WARN_ON_USE (pthread_rwlockattr_init, "pthread_rwlockattr_init is not portable - "
1206                  "use gnulib module pthread-rwlock for portability");
1207 # endif
1208 #endif
1209 
1210 #if @GNULIB_PTHREAD_RWLOCK@
1211 # if @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@
1212 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1213 #   undef pthread_rwlockattr_destroy
1214 #   define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
1215 #  endif
1216 _GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int,
1217                   (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1)));
1218 _GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int,
1219                   (pthread_rwlockattr_t *attr));
1220 # else
1221 #  if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@
1222 _GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int,
1223                   (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1)));
1224 #  endif
1225 _GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int,
1226                   (pthread_rwlockattr_t *attr));
1227 # endif
1228 # if __GLIBC__ >= 2
1229 _GL_CXXALIASWARN (pthread_rwlockattr_destroy);
1230 # endif
1231 #elif defined GNULIB_POSIXCHECK
1232 # undef pthread_rwlockattr_destroy
1233 # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY
1234 _GL_WARN_ON_USE (pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy is not portable - "
1235                  "use gnulib module pthread-rwlock for portability");
1236 # endif
1237 #endif
1238 
1239 #if @GNULIB_PTHREAD_RWLOCK@
1240 # if @REPLACE_PTHREAD_RWLOCK_RDLOCK@
1241 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1242 #   undef pthread_rwlock_rdlock
1243 #   define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
1244 #  endif
1245 _GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)
1246                                               _GL_ARG_NONNULL ((1)));
1247 _GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1248 # else
1249 #  if !@HAVE_PTHREAD_RWLOCK_RDLOCK@
1250 _GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)
1251                                               _GL_ARG_NONNULL ((1)));
1252 #  endif
1253 _GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1254 # endif
1255 # if __GLIBC__ >= 2
1256 _GL_CXXALIASWARN (pthread_rwlock_rdlock);
1257 # endif
1258 #elif defined GNULIB_POSIXCHECK
1259 # undef pthread_rwlock_rdlock
1260 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK
1261 _GL_WARN_ON_USE (pthread_rwlock_rdlock, "pthread_rwlock_rdlock is not portable - "
1262                  "use gnulib module pthread-rwlock for portability");
1263 # endif
1264 #endif
1265 
1266 #if @GNULIB_PTHREAD_RWLOCK@
1267 # if @REPLACE_PTHREAD_RWLOCK_WRLOCK@
1268 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1269 #   undef pthread_rwlock_wrlock
1270 #   define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
1271 #  endif
1272 _GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)
1273                                               _GL_ARG_NONNULL ((1)));
1274 _GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1275 # else
1276 #  if !@HAVE_PTHREAD_RWLOCK_WRLOCK@
1277 _GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)
1278                                               _GL_ARG_NONNULL ((1)));
1279 #  endif
1280 _GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1281 # endif
1282 # if __GLIBC__ >= 2
1283 _GL_CXXALIASWARN (pthread_rwlock_wrlock);
1284 # endif
1285 #elif defined GNULIB_POSIXCHECK
1286 # undef pthread_rwlock_wrlock
1287 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK
1288 _GL_WARN_ON_USE (pthread_rwlock_wrlock, "pthread_rwlock_wrlock is not portable - "
1289                  "use gnulib module pthread-rwlock for portability");
1290 # endif
1291 #endif
1292 
1293 #if @GNULIB_PTHREAD_RWLOCK@
1294 # if @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@
1295 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1296 #   undef pthread_rwlock_tryrdlock
1297 #   define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
1298 #  endif
1299 _GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)
1300                                                  _GL_ARG_NONNULL ((1)));
1301 _GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1302 # else
1303 #  if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
1304 _GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)
1305                                                  _GL_ARG_NONNULL ((1)));
1306 #  endif
1307 _GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1308 # endif
1309 # if __GLIBC__ >= 2
1310 _GL_CXXALIASWARN (pthread_rwlock_tryrdlock);
1311 # endif
1312 #elif defined GNULIB_POSIXCHECK
1313 # undef pthread_rwlock_tryrdlock
1314 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK
1315 _GL_WARN_ON_USE (pthread_rwlock_tryrdlock, "pthread_rwlock_tryrdlock is not portable - "
1316                  "use gnulib module pthread-rwlock for portability");
1317 # endif
1318 #endif
1319 
1320 #if @GNULIB_PTHREAD_RWLOCK@
1321 # if @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@
1322 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1323 #   undef pthread_rwlock_trywrlock
1324 #   define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
1325 #  endif
1326 _GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)
1327                                                  _GL_ARG_NONNULL ((1)));
1328 _GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1329 # else
1330 #  if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
1331 _GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)
1332                                                  _GL_ARG_NONNULL ((1)));
1333 #  endif
1334 _GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1335 # endif
1336 # if __GLIBC__ >= 2
1337 _GL_CXXALIASWARN (pthread_rwlock_trywrlock);
1338 # endif
1339 #elif defined GNULIB_POSIXCHECK
1340 # undef pthread_rwlock_trywrlock
1341 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK
1342 _GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not portable - "
1343                  "use gnulib module pthread-rwlock for portability");
1344 # endif
1345 #endif
1346 
1347 #if @GNULIB_PTHREAD_RWLOCK@
1348 # if @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1349 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1350 #   undef pthread_rwlock_timedrdlock
1351 #   define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock
1352 #  endif
1353 _GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int,
1354                   (pthread_rwlock_t *restrict lock,
1355                    const struct timespec *restrict abstime)
1356                   _GL_ARG_NONNULL ((1, 2)));
1357 _GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int,
1358                   (pthread_rwlock_t *restrict lock,
1359                    const struct timespec *restrict abstime));
1360 # else
1361 #  if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1362 _GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int,
1363                   (pthread_rwlock_t *restrict lock,
1364                    const struct timespec *restrict abstime)
1365                   _GL_ARG_NONNULL ((1, 2)));
1366 #  endif
1367 _GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int,
1368                   (pthread_rwlock_t *restrict lock,
1369                    const struct timespec *restrict abstime));
1370 # endif
1371 # if __GLIBC__ >= 2
1372 _GL_CXXALIASWARN (pthread_rwlock_timedrdlock);
1373 # endif
1374 #elif defined GNULIB_POSIXCHECK
1375 # undef pthread_rwlock_timedrdlock
1376 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK
1377 _GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not portable - "
1378                  "use gnulib module pthread-rwlock for portability");
1379 # endif
1380 #endif
1381 
1382 #if @GNULIB_PTHREAD_RWLOCK@
1383 # if @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1384 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1385 #   undef pthread_rwlock_timedwrlock
1386 #   define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock
1387 #  endif
1388 _GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int,
1389                   (pthread_rwlock_t *restrict lock,
1390                    const struct timespec *restrict abstime)
1391                   _GL_ARG_NONNULL ((1, 2)));
1392 _GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int,
1393                   (pthread_rwlock_t *restrict lock,
1394                    const struct timespec *restrict abstime));
1395 # else
1396 #  if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1397 _GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int,
1398                   (pthread_rwlock_t *restrict lock,
1399                    const struct timespec *restrict abstime)
1400                   _GL_ARG_NONNULL ((1, 2)));
1401 #  endif
1402 _GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int,
1403                   (pthread_rwlock_t *restrict lock,
1404                    const struct timespec *restrict abstime));
1405 # endif
1406 # if __GLIBC__ >= 2
1407 _GL_CXXALIASWARN (pthread_rwlock_timedwrlock);
1408 # endif
1409 #elif defined GNULIB_POSIXCHECK
1410 # undef pthread_rwlock_timedwrlock
1411 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK
1412 _GL_WARN_ON_USE (pthread_rwlock_timedwrlock, "pthread_rwlock_timedwrlock is not portable - "
1413                  "use gnulib module pthread-rwlock for portability");
1414 # endif
1415 #endif
1416 
1417 #if @GNULIB_PTHREAD_RWLOCK@
1418 # if @REPLACE_PTHREAD_RWLOCK_UNLOCK@
1419 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1420 #   undef pthread_rwlock_unlock
1421 #   define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
1422 #  endif
1423 _GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)
1424                                               _GL_ARG_NONNULL ((1)));
1425 _GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
1426 # else
1427 #  if !@HAVE_PTHREAD_RWLOCK_UNLOCK@
1428 _GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)
1429                                               _GL_ARG_NONNULL ((1)));
1430 #  endif
1431 _GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
1432 # endif
1433 # if __GLIBC__ >= 2
1434 _GL_CXXALIASWARN (pthread_rwlock_unlock);
1435 # endif
1436 #elif defined GNULIB_POSIXCHECK
1437 # undef pthread_rwlock_unlock
1438 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK
1439 _GL_WARN_ON_USE (pthread_rwlock_unlock, "pthread_rwlock_unlock is not portable - "
1440                  "use gnulib module pthread-rwlock for portability");
1441 # endif
1442 #endif
1443 
1444 #if @GNULIB_PTHREAD_RWLOCK@
1445 # if @REPLACE_PTHREAD_RWLOCK_DESTROY@
1446 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1447 #   undef pthread_rwlock_destroy
1448 #   define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
1449 #  endif
1450 _GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)
1451                                                _GL_ARG_NONNULL ((1)));
1452 _GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
1453 # else
1454 #  if !@HAVE_PTHREAD_RWLOCK_DESTROY@
1455 _GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)
1456                                                _GL_ARG_NONNULL ((1)));
1457 #  endif
1458 _GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
1459 # endif
1460 # if __GLIBC__ >= 2
1461 _GL_CXXALIASWARN (pthread_rwlock_destroy);
1462 # endif
1463 #elif defined GNULIB_POSIXCHECK
1464 # undef pthread_rwlock_destroy
1465 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY
1466 _GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable - "
1467                  "use gnulib module pthread-rwlock for portability");
1468 # endif
1469 #endif
1470 
1471 /* =========== Condition variable functions =========== */
1472 
1473 #if @GNULIB_PTHREAD_COND@
1474 # if @REPLACE_PTHREAD_COND_INIT@
1475 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1476 #   undef pthread_cond_init
1477 #   define pthread_cond_init rpl_pthread_cond_init
1478 #  endif
1479 _GL_FUNCDECL_RPL (pthread_cond_init, int,
1480                   (pthread_cond_t *restrict cond,
1481                    const pthread_condattr_t *restrict attr)
1482                   _GL_ARG_NONNULL ((1)));
1483 _GL_CXXALIAS_RPL (pthread_cond_init, int,
1484                   (pthread_cond_t *restrict cond,
1485                    const pthread_condattr_t *restrict attr));
1486 # else
1487 #  if !@HAVE_PTHREAD_COND_INIT@
1488 _GL_FUNCDECL_SYS (pthread_cond_init, int,
1489                   (pthread_cond_t *restrict cond,
1490                    const pthread_condattr_t *restrict attr)
1491                   _GL_ARG_NONNULL ((1)));
1492 #  endif
1493 _GL_CXXALIAS_SYS (pthread_cond_init, int,
1494                   (pthread_cond_t *restrict cond,
1495                    const pthread_condattr_t *restrict attr));
1496 # endif
1497 # if __GLIBC__ >= 2
1498 _GL_CXXALIASWARN (pthread_cond_init);
1499 # endif
1500 #elif defined GNULIB_POSIXCHECK
1501 # undef pthread_cond_init
1502 # if HAVE_RAW_DECL_PTHREAD_COND_INIT
1503 _GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init is not portable - "
1504                  "use gnulib module pthread-cond for portability");
1505 # endif
1506 #endif
1507 
1508 #if @GNULIB_PTHREAD_COND@
1509 # if @REPLACE_PTHREAD_CONDATTR_INIT@
1510 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1511 #   undef pthread_condattr_init
1512 #   define pthread_condattr_init rpl_pthread_condattr_init
1513 #  endif
1514 _GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr)
1515                                               _GL_ARG_NONNULL ((1)));
1516 _GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr));
1517 # else
1518 #  if !@HAVE_PTHREAD_CONDATTR_INIT@
1519 _GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr)
1520                                               _GL_ARG_NONNULL ((1)));
1521 #  endif
1522 _GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr));
1523 # endif
1524 # if __GLIBC__ >= 2
1525 _GL_CXXALIASWARN (pthread_condattr_init);
1526 # endif
1527 #elif defined GNULIB_POSIXCHECK
1528 # undef pthread_condattr_init
1529 # if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT
1530 _GL_WARN_ON_USE (pthread_condattr_init, "pthread_condattr_init is not portable - "
1531                  "use gnulib module pthread-cond for portability");
1532 # endif
1533 #endif
1534 
1535 #if @GNULIB_PTHREAD_COND@
1536 # if @REPLACE_PTHREAD_CONDATTR_DESTROY@
1537 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1538 #   undef pthread_condattr_destroy
1539 #   define pthread_condattr_destroy rpl_pthread_condattr_destroy
1540 #  endif
1541 _GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr)
1542                                                  _GL_ARG_NONNULL ((1)));
1543 _GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
1544 # else
1545 #  if !@HAVE_PTHREAD_CONDATTR_DESTROY@
1546 _GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr)
1547                                                  _GL_ARG_NONNULL ((1)));
1548 #  endif
1549 _GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
1550 # endif
1551 # if __GLIBC__ >= 2
1552 _GL_CXXALIASWARN (pthread_condattr_destroy);
1553 # endif
1554 #elif defined GNULIB_POSIXCHECK
1555 # undef pthread_condattr_destroy
1556 # if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY
1557 _GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not portable - "
1558                  "use gnulib module pthread-cond for portability");
1559 # endif
1560 #endif
1561 
1562 #if @GNULIB_PTHREAD_COND@
1563 # if @REPLACE_PTHREAD_COND_WAIT@
1564 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1565 #   undef pthread_cond_wait
1566 #   define pthread_cond_wait rpl_pthread_cond_wait
1567 #  endif
1568 _GL_FUNCDECL_RPL (pthread_cond_wait, int,
1569                   (pthread_cond_t *restrict cond,
1570                    pthread_mutex_t *restrict mutex)
1571                   _GL_ARG_NONNULL ((1, 2)));
1572 _GL_CXXALIAS_RPL (pthread_cond_wait, int,
1573                   (pthread_cond_t *restrict cond,
1574                    pthread_mutex_t *restrict mutex));
1575 # else
1576 #  if !@HAVE_PTHREAD_COND_WAIT@
1577 _GL_FUNCDECL_SYS (pthread_cond_wait, int,
1578                   (pthread_cond_t *restrict cond,
1579                    pthread_mutex_t *restrict mutex)
1580                   _GL_ARG_NONNULL ((1, 2)));
1581 #  endif
1582 _GL_CXXALIAS_SYS (pthread_cond_wait, int,
1583                   (pthread_cond_t *restrict cond,
1584                    pthread_mutex_t *restrict mutex));
1585 # endif
1586 # if __GLIBC__ >= 2
1587 _GL_CXXALIASWARN (pthread_cond_wait);
1588 # endif
1589 #elif defined GNULIB_POSIXCHECK
1590 # undef pthread_cond_wait
1591 # if HAVE_RAW_DECL_PTHREAD_COND_WAIT
1592 _GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is not portable - "
1593                  "use gnulib module pthread-cond for portability");
1594 # endif
1595 #endif
1596 
1597 #if @GNULIB_PTHREAD_COND@
1598 # if @REPLACE_PTHREAD_COND_TIMEDWAIT@
1599 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1600 #   undef pthread_cond_timedwait
1601 #   define pthread_cond_timedwait rpl_pthread_cond_timedwait
1602 #  endif
1603 _GL_FUNCDECL_RPL (pthread_cond_timedwait, int,
1604                   (pthread_cond_t *restrict cond,
1605                    pthread_mutex_t *restrict mutex,
1606                    const struct timespec *restrict abstime)
1607                   _GL_ARG_NONNULL ((1, 2, 3)));
1608 _GL_CXXALIAS_RPL (pthread_cond_timedwait, int,
1609                   (pthread_cond_t *restrict cond,
1610                    pthread_mutex_t *restrict mutex,
1611                    const struct timespec *restrict abstime));
1612 # else
1613 #  if !@HAVE_PTHREAD_COND_TIMEDWAIT@
1614 _GL_FUNCDECL_SYS (pthread_cond_timedwait, int,
1615                   (pthread_cond_t *restrict cond,
1616                    pthread_mutex_t *restrict mutex,
1617                    const struct timespec *restrict abstime)
1618                   _GL_ARG_NONNULL ((1, 2, 3)));
1619 #  endif
1620 _GL_CXXALIAS_SYS (pthread_cond_timedwait, int,
1621                   (pthread_cond_t *restrict cond,
1622                    pthread_mutex_t *restrict mutex,
1623                    const struct timespec *restrict abstime));
1624 # endif
1625 # if __GLIBC__ >= 2
1626 _GL_CXXALIASWARN (pthread_cond_timedwait);
1627 # endif
1628 #elif defined GNULIB_POSIXCHECK
1629 # undef pthread_cond_timedwait
1630 # if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT
1631 _GL_WARN_ON_USE (pthread_cond_timedwait, "pthread_cond_timedwait is not portable - "
1632                  "use gnulib module pthread-cond for portability");
1633 # endif
1634 #endif
1635 
1636 #if @GNULIB_PTHREAD_COND@
1637 # if @REPLACE_PTHREAD_COND_SIGNAL@
1638 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1639 #   undef pthread_cond_signal
1640 #   define pthread_cond_signal rpl_pthread_cond_signal
1641 #  endif
1642 _GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond)
1643                                             _GL_ARG_NONNULL ((1)));
1644 _GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond));
1645 # else
1646 #  if !@HAVE_PTHREAD_COND_SIGNAL@
1647 _GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond)
1648                                             _GL_ARG_NONNULL ((1)));
1649 #  endif
1650 _GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond));
1651 # endif
1652 # if __GLIBC__ >= 2
1653 _GL_CXXALIASWARN (pthread_cond_signal);
1654 # endif
1655 #elif defined GNULIB_POSIXCHECK
1656 # undef pthread_cond_signal
1657 # if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL
1658 _GL_WARN_ON_USE (pthread_cond_signal, "pthread_cond_signal is not portable - "
1659                  "use gnulib module pthread-cond for portability");
1660 # endif
1661 #endif
1662 
1663 #if @GNULIB_PTHREAD_COND@
1664 # if @REPLACE_PTHREAD_COND_BROADCAST@
1665 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1666 #   undef pthread_cond_broadcast
1667 #   define pthread_cond_broadcast rpl_pthread_cond_broadcast
1668 #  endif
1669 _GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond)
1670                                                _GL_ARG_NONNULL ((1)));
1671 _GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond));
1672 # else
1673 #  if !@HAVE_PTHREAD_COND_BROADCAST@
1674 _GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond)
1675                                                _GL_ARG_NONNULL ((1)));
1676 #  endif
1677 _GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond));
1678 # endif
1679 # if __GLIBC__ >= 2
1680 _GL_CXXALIASWARN (pthread_cond_broadcast);
1681 # endif
1682 #elif defined GNULIB_POSIXCHECK
1683 # undef pthread_cond_broadcast
1684 # if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST
1685 _GL_WARN_ON_USE (pthread_cond_broadcast, "pthread_cond_broadcast is not portable - "
1686                  "use gnulib module pthread-cond for portability");
1687 # endif
1688 #endif
1689 
1690 #if @GNULIB_PTHREAD_COND@
1691 # if @REPLACE_PTHREAD_COND_DESTROY@
1692 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1693 #   undef pthread_cond_destroy
1694 #   define pthread_cond_destroy rpl_pthread_cond_destroy
1695 #  endif
1696 _GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond)
1697                                              _GL_ARG_NONNULL ((1)));
1698 _GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond));
1699 # else
1700 #  if !@HAVE_PTHREAD_COND_DESTROY@
1701 _GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond)
1702                                              _GL_ARG_NONNULL ((1)));
1703 #  endif
1704 _GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond));
1705 # endif
1706 # if __GLIBC__ >= 2
1707 _GL_CXXALIASWARN (pthread_cond_destroy);
1708 # endif
1709 #elif defined GNULIB_POSIXCHECK
1710 # undef pthread_cond_destroy
1711 # if HAVE_RAW_DECL_PTHREAD_COND_DESTROY
1712 _GL_WARN_ON_USE (pthread_cond_destroy, "pthread_cond_destroy is not portable - "
1713                  "use gnulib module pthread-cond for portability");
1714 # endif
1715 #endif
1716 
1717 /* =========== Thread-specific storage functions =========== */
1718 
1719 #if @GNULIB_PTHREAD_TSS@
1720 # if @REPLACE_PTHREAD_KEY_CREATE@
1721 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1722 #   undef pthread_key_create
1723 #   define pthread_key_create rpl_pthread_key_create
1724 #  endif
1725 _GL_FUNCDECL_RPL (pthread_key_create, int,
1726                   (pthread_key_t *keyp, void (*destructor) (void *))
1727                   _GL_ARG_NONNULL ((1)));
1728 _GL_CXXALIAS_RPL (pthread_key_create, int,
1729                   (pthread_key_t *keyp, void (*destructor) (void *)));
1730 # else
1731 #  if !@HAVE_PTHREAD_KEY_CREATE@
1732 _GL_FUNCDECL_SYS (pthread_key_create, int,
1733                   (pthread_key_t *keyp, void (*destructor) (void *))
1734                   _GL_ARG_NONNULL ((1)));
1735 #  endif
1736 _GL_CXXALIAS_SYS_CAST (pthread_key_create, int,
1737                        (pthread_key_t *keyp, void (*destructor) (void *)));
1738 # endif
1739 # if __GLIBC__ >= 2
1740 _GL_CXXALIASWARN (pthread_key_create);
1741 # endif
1742 #elif defined GNULIB_POSIXCHECK
1743 # undef pthread_key_create
1744 # if HAVE_RAW_DECL_PTHREAD_KEY_CREATE
1745 _GL_WARN_ON_USE (pthread_key_create, "pthread_key_create is not portable - "
1746                  "use gnulib module pthread-tss for portability");
1747 # endif
1748 #endif
1749 
1750 #if @GNULIB_PTHREAD_TSS@
1751 # if @REPLACE_PTHREAD_SETSPECIFIC@
1752 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1753 #   undef pthread_setspecific
1754 #   define pthread_setspecific rpl_pthread_setspecific
1755 #  endif
1756 _GL_FUNCDECL_RPL (pthread_setspecific, int,
1757                   (pthread_key_t key, const void *value));
1758 _GL_CXXALIAS_RPL (pthread_setspecific, int,
1759                   (pthread_key_t key, const void *value));
1760 # else
1761 #  if !@HAVE_PTHREAD_SETSPECIFIC@
1762 _GL_FUNCDECL_SYS (pthread_setspecific, int,
1763                   (pthread_key_t key, const void *value));
1764 #  endif
1765 _GL_CXXALIAS_SYS (pthread_setspecific, int,
1766                   (pthread_key_t key, const void *value));
1767 # endif
1768 # if __GLIBC__ >= 2
1769 _GL_CXXALIASWARN (pthread_setspecific);
1770 # endif
1771 #elif defined GNULIB_POSIXCHECK
1772 # undef pthread_setspecific
1773 # if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC
1774 _GL_WARN_ON_USE (pthread_setspecific, "pthread_setspecific is not portable - "
1775                  "use gnulib module pthread-tss for portability");
1776 # endif
1777 #endif
1778 
1779 #if @GNULIB_PTHREAD_TSS@
1780 # if @REPLACE_PTHREAD_GETSPECIFIC@
1781 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1782 #   undef pthread_getspecific
1783 #   define pthread_getspecific rpl_pthread_getspecific
1784 #  endif
1785 _GL_FUNCDECL_RPL (pthread_getspecific, void *, (pthread_key_t key));
1786 _GL_CXXALIAS_RPL (pthread_getspecific, void *, (pthread_key_t key));
1787 # else
1788 #  if !@HAVE_PTHREAD_GETSPECIFIC@
1789 _GL_FUNCDECL_SYS (pthread_getspecific, void *, (pthread_key_t key));
1790 #  endif
1791 _GL_CXXALIAS_SYS (pthread_getspecific, void *, (pthread_key_t key));
1792 # endif
1793 # if __GLIBC__ >= 2
1794 _GL_CXXALIASWARN (pthread_getspecific);
1795 # endif
1796 #elif defined GNULIB_POSIXCHECK
1797 # undef pthread_getspecific
1798 # if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC
1799 _GL_WARN_ON_USE (pthread_getspecific, "pthread_getspecific is not portable - "
1800                  "use gnulib module pthread-tss for portability");
1801 # endif
1802 #endif
1803 
1804 #if @GNULIB_PTHREAD_TSS@
1805 # if @REPLACE_PTHREAD_KEY_DELETE@
1806 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1807 #   undef pthread_key_delete
1808 #   define pthread_key_delete rpl_pthread_key_delete
1809 #  endif
1810 _GL_FUNCDECL_RPL (pthread_key_delete, int, (pthread_key_t key));
1811 _GL_CXXALIAS_RPL (pthread_key_delete, int, (pthread_key_t key));
1812 # else
1813 #  if !@HAVE_PTHREAD_KEY_DELETE@
1814 _GL_FUNCDECL_SYS (pthread_key_delete, int, (pthread_key_t key));
1815 #  endif
1816 _GL_CXXALIAS_SYS (pthread_key_delete, int, (pthread_key_t key));
1817 # endif
1818 # if __GLIBC__ >= 2
1819 _GL_CXXALIASWARN (pthread_key_delete);
1820 # endif
1821 #elif defined GNULIB_POSIXCHECK
1822 # undef pthread_key_delete
1823 # if HAVE_RAW_DECL_PTHREAD_KEY_DELETE
1824 _GL_WARN_ON_USE (pthread_key_delete, "pthread_key_delete is not portable - "
1825                  "use gnulib module pthread-tss for portability");
1826 # endif
1827 #endif
1828 
1829 /* =========== Spinlock functions =========== */
1830 
1831 #if @GNULIB_PTHREAD_SPIN@
1832 # if @REPLACE_PTHREAD_SPIN_INIT@
1833 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1834 #   undef pthread_spin_init
1835 #   define pthread_spin_init rpl_pthread_spin_init
1836 #  endif
1837 _GL_FUNCDECL_RPL (pthread_spin_init, int,
1838                   (pthread_spinlock_t *lock, int shared_across_processes)
1839                   _GL_ARG_NONNULL ((1)));
1840 _GL_CXXALIAS_RPL (pthread_spin_init, int,
1841                   (pthread_spinlock_t *lock, int shared_across_processes));
1842 # else
1843 #  if !@HAVE_PTHREAD_SPIN_INIT@
1844 _GL_FUNCDECL_SYS (pthread_spin_init, int,
1845                   (pthread_spinlock_t *lock, int shared_across_processes)
1846                   _GL_ARG_NONNULL ((1)));
1847 #  endif
1848 _GL_CXXALIAS_SYS (pthread_spin_init, int,
1849                   (pthread_spinlock_t *lock, int shared_across_processes));
1850 # endif
1851 # if __GLIBC__ >= 2
1852 _GL_CXXALIASWARN (pthread_spin_init);
1853 # endif
1854 #elif defined GNULIB_POSIXCHECK
1855 # undef pthread_spin_init
1856 # if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
1857 _GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init is not portable - "
1858                  "use gnulib module pthread-spin for portability");
1859 # endif
1860 #endif
1861 
1862 #if @GNULIB_PTHREAD_SPIN@
1863 # if @REPLACE_PTHREAD_SPIN_LOCK@
1864 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1865 #   undef pthread_spin_lock
1866 #   define pthread_spin_lock rpl_pthread_spin_lock
1867 #  endif
1868 _GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock)
1869                                           _GL_ARG_NONNULL ((1)));
1870 _GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock));
1871 # else
1872 #  if !@HAVE_PTHREAD_SPIN_LOCK@
1873 _GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock)
1874                                           _GL_ARG_NONNULL ((1)));
1875 #  endif
1876 _GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock));
1877 # endif
1878 # if __GLIBC__ >= 2
1879 _GL_CXXALIASWARN (pthread_spin_lock);
1880 # endif
1881 #elif defined GNULIB_POSIXCHECK
1882 # undef pthread_spin_lock
1883 # if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
1884 _GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock is not portable - "
1885                  "use gnulib module pthread-spin for portability");
1886 # endif
1887 #endif
1888 
1889 #if @GNULIB_PTHREAD_SPIN@
1890 # if @REPLACE_PTHREAD_SPIN_TRYLOCK@
1891 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1892 #   undef pthread_spin_trylock
1893 #   define pthread_spin_trylock rpl_pthread_spin_trylock
1894 #  endif
1895 _GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock)
1896                                              _GL_ARG_NONNULL ((1)));
1897 _GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
1898 # else
1899 #  if !@HAVE_PTHREAD_SPIN_TRYLOCK@
1900 _GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock)
1901                                              _GL_ARG_NONNULL ((1)));
1902 #  endif
1903 _GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
1904 # endif
1905 # if __GLIBC__ >= 2
1906 _GL_CXXALIASWARN (pthread_spin_trylock);
1907 # endif
1908 #elif defined GNULIB_POSIXCHECK
1909 # undef pthread_spin_trylock
1910 # if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
1911 _GL_WARN_ON_USE (pthread_spin_trylock, "pthread_spin_trylock is not portable - "
1912                  "use gnulib module pthread-spin for portability");
1913 # endif
1914 #endif
1915 
1916 #if @GNULIB_PTHREAD_SPIN@
1917 # if @REPLACE_PTHREAD_SPIN_UNLOCK@
1918 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1919 #   undef pthread_spin_unlock
1920 #   define pthread_spin_unlock rpl_pthread_spin_unlock
1921 #  endif
1922 _GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock)
1923                                             _GL_ARG_NONNULL ((1)));
1924 _GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
1925 # else
1926 #  if !@HAVE_PTHREAD_SPIN_UNLOCK@
1927 _GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock)
1928                                             _GL_ARG_NONNULL ((1)));
1929 #  endif
1930 _GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
1931 # endif
1932 # if __GLIBC__ >= 2
1933 _GL_CXXALIASWARN (pthread_spin_unlock);
1934 # endif
1935 #elif defined GNULIB_POSIXCHECK
1936 # undef pthread_spin_unlock
1937 # if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
1938 _GL_WARN_ON_USE (pthread_spin_unlock, "pthread_spin_unlock is not portable - "
1939                  "use gnulib module pthread-spin for portability");
1940 # endif
1941 #endif
1942 
1943 #if @GNULIB_PTHREAD_SPIN@
1944 # if @REPLACE_PTHREAD_SPIN_DESTROY@
1945 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1946 #   undef pthread_spin_destroy
1947 #   define pthread_spin_destroy rpl_pthread_spin_destroy
1948 #  endif
1949 _GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock)
1950                                              _GL_ARG_NONNULL ((1)));
1951 _GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
1952 # else
1953 #  if !@HAVE_PTHREAD_SPIN_DESTROY@
1954 _GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock)
1955                                              _GL_ARG_NONNULL ((1)));
1956 #  endif
1957 _GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
1958 # endif
1959 # if __GLIBC__ >= 2
1960 _GL_CXXALIASWARN (pthread_spin_destroy);
1961 # endif
1962 #elif defined GNULIB_POSIXCHECK
1963 # undef pthread_spin_destroy
1964 # if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
1965 _GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - "
1966                  "use gnulib module pthread-spin for portability");
1967 # endif
1968 #endif
1969 
1970 
1971 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
1972 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
1973 #endif
1974