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