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 # if @REPLACE_PTHREAD_CREATE@
453 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
454 #   undef pthread_create
455 #   define pthread_create rpl_pthread_create
456 #  endif
457 _GL_FUNCDECL_RPL (pthread_create, int,
458                   (pthread_t *threadp, const pthread_attr_t *attr,
459                    void * (*mainfunc) (void *), void *arg)
460                   _GL_ARG_NONNULL ((1, 3)));
461 _GL_CXXALIAS_RPL (pthread_create, int,
462                   (pthread_t *threadp, const pthread_attr_t *attr,
463                    void * (*mainfunc) (void *), void *arg));
464 # else
465 #  if !@HAVE_PTHREAD_CREATE@
466 _GL_FUNCDECL_SYS (pthread_create, int,
467                   (pthread_t *threadp, const pthread_attr_t *attr,
468                    void * (*mainfunc) (void *), void *arg)
469                   _GL_ARG_NONNULL ((1, 3)));
470 #  endif
471 _GL_CXXALIAS_SYS_CAST (pthread_create, int,
472                        (pthread_t *threadp, const pthread_attr_t *attr,
473                         void * (*mainfunc) (void *), void *arg));
474 # endif
475 _GL_CXXALIASWARN (pthread_create);
476 #elif defined GNULIB_POSIXCHECK
477 # undef pthread_create
478 # if HAVE_RAW_DECL_PTHREAD_CREATE
479 _GL_WARN_ON_USE (pthread_create, "pthread_create is not portable - "
480                  "use gnulib module pthread-thread for portability");
481 # endif
482 #endif
483 
484 #if @GNULIB_PTHREAD_THREAD@
485 # if @REPLACE_PTHREAD_ATTR_INIT@
486 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
487 #   undef pthread_attr_init
488 #   define pthread_attr_init rpl_pthread_attr_init
489 #  endif
490 _GL_FUNCDECL_RPL (pthread_attr_init, int, (pthread_attr_t *attr)
491                                           _GL_ARG_NONNULL ((1)));
492 _GL_CXXALIAS_RPL (pthread_attr_init, int, (pthread_attr_t *attr));
493 # else
494 #  if !@HAVE_PTHREAD_ATTR_INIT@
495 _GL_FUNCDECL_SYS (pthread_attr_init, int, (pthread_attr_t *attr)
496                                           _GL_ARG_NONNULL ((1)));
497 #  endif
498 _GL_CXXALIAS_SYS (pthread_attr_init, int, (pthread_attr_t *attr));
499 # endif
500 _GL_CXXALIASWARN (pthread_attr_init);
501 #elif defined GNULIB_POSIXCHECK
502 # undef pthread_attr_init
503 # if HAVE_RAW_DECL_PTHREAD_ATTR_INIT
504 _GL_WARN_ON_USE (pthread_attr_init, "pthread_attr_init is not portable - "
505                  "use gnulib module pthread-thread for portability");
506 # endif
507 #endif
508 
509 #if @GNULIB_PTHREAD_THREAD@
510 # if @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@
511 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
512 #   undef pthread_attr_getdetachstate
513 #   define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
514 #  endif
515 _GL_FUNCDECL_RPL (pthread_attr_getdetachstate, int,
516                   (const pthread_attr_t *attr, int *detachstatep)
517                   _GL_ARG_NONNULL ((1, 2)));
518 _GL_CXXALIAS_RPL (pthread_attr_getdetachstate, int,
519                   (const pthread_attr_t *attr, int *detachstatep));
520 # else
521 #  if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@
522 _GL_FUNCDECL_SYS (pthread_attr_getdetachstate, int,
523                   (const pthread_attr_t *attr, int *detachstatep)
524                   _GL_ARG_NONNULL ((1, 2)));
525 #  endif
526 _GL_CXXALIAS_SYS (pthread_attr_getdetachstate, int,
527                   (const pthread_attr_t *attr, int *detachstatep));
528 # endif
529 _GL_CXXALIASWARN (pthread_attr_getdetachstate);
530 #elif defined GNULIB_POSIXCHECK
531 # undef pthread_attr_getdetachstate
532 # if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE
533 _GL_WARN_ON_USE (pthread_attr_getdetachstate, "pthread_attr_getdetachstate is not portable - "
534                  "use gnulib module pthread-thread for portability");
535 # endif
536 #endif
537 
538 #if @GNULIB_PTHREAD_THREAD@
539 # if @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@
540 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
541 #   undef pthread_attr_setdetachstate
542 #   define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
543 #  endif
544 _GL_FUNCDECL_RPL (pthread_attr_setdetachstate, int,
545                   (pthread_attr_t *attr, int detachstate)
546                   _GL_ARG_NONNULL ((1)));
547 _GL_CXXALIAS_RPL (pthread_attr_setdetachstate, int,
548                   (pthread_attr_t *attr, int detachstate));
549 # else
550 #  if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@
551 _GL_FUNCDECL_SYS (pthread_attr_setdetachstate, int,
552                   (pthread_attr_t *attr, int detachstate)
553                   _GL_ARG_NONNULL ((1)));
554 #  endif
555 _GL_CXXALIAS_SYS (pthread_attr_setdetachstate, int,
556                   (pthread_attr_t *attr, int detachstate));
557 # endif
558 _GL_CXXALIASWARN (pthread_attr_setdetachstate);
559 #elif defined GNULIB_POSIXCHECK
560 # undef pthread_attr_setdetachstate
561 # if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE
562 _GL_WARN_ON_USE (pthread_attr_setdetachstate, "pthread_attr_setdetachstate is not portable - "
563                  "use gnulib module pthread-thread for portability");
564 # endif
565 #endif
566 
567 #if @GNULIB_PTHREAD_THREAD@
568 # if @REPLACE_PTHREAD_ATTR_DESTROY@
569 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
570 #   undef pthread_attr_destroy
571 #   define pthread_attr_destroy rpl_pthread_attr_destroy
572 #  endif
573 _GL_FUNCDECL_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr)
574                                              _GL_ARG_NONNULL ((1)));
575 _GL_CXXALIAS_RPL (pthread_attr_destroy, int, (pthread_attr_t *attr));
576 # else
577 #  if !@HAVE_PTHREAD_ATTR_DESTROY@
578 _GL_FUNCDECL_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr)
579                                              _GL_ARG_NONNULL ((1)));
580 #  endif
581 _GL_CXXALIAS_SYS (pthread_attr_destroy, int, (pthread_attr_t *attr));
582 # endif
583 _GL_CXXALIASWARN (pthread_attr_destroy);
584 #elif defined GNULIB_POSIXCHECK
585 # undef pthread_attr_destroy
586 # if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY
587 _GL_WARN_ON_USE (pthread_attr_destroy, "pthread_attr_destroy is not portable - "
588                  "use gnulib module pthread-thread for portability");
589 # endif
590 #endif
591 
592 #if @GNULIB_PTHREAD_THREAD@
593 # if @REPLACE_PTHREAD_SELF@
594 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
595 #   undef pthread_self
596 #   define pthread_self rpl_pthread_self
597 #  endif
598 _GL_FUNCDECL_RPL (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE);
599 _GL_CXXALIAS_RPL (pthread_self, pthread_t, (void));
600 # else
601 #  if !@HAVE_PTHREAD_SELF@
602 _GL_FUNCDECL_SYS (pthread_self, pthread_t, (void) _GL_ATTRIBUTE_PURE);
603 #  endif
604 _GL_CXXALIAS_SYS (pthread_self, pthread_t, (void));
605 # endif
606 _GL_CXXALIASWARN (pthread_self);
607 #elif defined GNULIB_POSIXCHECK
608 # undef pthread_self
609 # if HAVE_RAW_DECL_PTHREAD_SELF
610 _GL_WARN_ON_USE (pthread_self, "pthread_self is not portable - "
611                  "use gnulib module pthread-thread for portability");
612 # endif
613 #endif
614 
615 #if @GNULIB_PTHREAD_THREAD@
616 # if @REPLACE_PTHREAD_EQUAL@
617 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
618 #   undef pthread_equal
619 #   define pthread_equal rpl_pthread_equal
620 #  endif
621 _GL_FUNCDECL_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
622 _GL_CXXALIAS_RPL (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
623 # else
624 #  if !@HAVE_PTHREAD_EQUAL@
625 _GL_FUNCDECL_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
626 #  endif
627 _GL_CXXALIAS_SYS (pthread_equal, int, (pthread_t thread1, pthread_t thread2));
628 # endif
629 _GL_CXXALIASWARN (pthread_equal);
630 #elif defined GNULIB_POSIXCHECK
631 # undef pthread_equal
632 # if HAVE_RAW_DECL_PTHREAD_EQUAL
633 _GL_WARN_ON_USE (pthread_equal, "pthread_equal is not portable - "
634                  "use gnulib module pthread-thread for portability");
635 # endif
636 #endif
637 
638 #if @GNULIB_PTHREAD_THREAD@
639 # if @REPLACE_PTHREAD_DETACH@
640 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
641 #   undef pthread_detach
642 #   define pthread_detach rpl_pthread_detach
643 #  endif
644 _GL_FUNCDECL_RPL (pthread_detach, int, (pthread_t thread));
645 _GL_CXXALIAS_RPL (pthread_detach, int, (pthread_t thread));
646 # else
647 #  if !@HAVE_PTHREAD_DETACH@
648 _GL_FUNCDECL_SYS (pthread_detach, int, (pthread_t thread));
649 #  endif
650 _GL_CXXALIAS_SYS (pthread_detach, int, (pthread_t thread));
651 # endif
652 _GL_CXXALIASWARN (pthread_detach);
653 #elif defined GNULIB_POSIXCHECK
654 # undef pthread_detach
655 # if HAVE_RAW_DECL_PTHREAD_DETACH
656 _GL_WARN_ON_USE (pthread_detach, "pthread_detach is not portable - "
657                  "use gnulib module pthread-thread for portability");
658 # endif
659 #endif
660 
661 #if @GNULIB_PTHREAD_THREAD@
662 # if @REPLACE_PTHREAD_JOIN@
663 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
664 #   undef pthread_join
665 #   define pthread_join rpl_pthread_join
666 #  endif
667 _GL_FUNCDECL_RPL (pthread_join, int, (pthread_t thread, void **valuep));
668 _GL_CXXALIAS_RPL (pthread_join, int, (pthread_t thread, void **valuep));
669 # else
670 #  if !@HAVE_PTHREAD_JOIN@
671 _GL_FUNCDECL_SYS (pthread_join, int, (pthread_t thread, void **valuep));
672 #  endif
673 _GL_CXXALIAS_SYS (pthread_join, int, (pthread_t thread, void **valuep));
674 # endif
675 _GL_CXXALIASWARN (pthread_join);
676 #elif defined GNULIB_POSIXCHECK
677 # undef pthread_join
678 # if HAVE_RAW_DECL_PTHREAD_JOIN
679 _GL_WARN_ON_USE (pthread_join, "pthread_join is not portable - "
680                  "use gnulib module pthread-thread for portability");
681 # endif
682 #endif
683 
684 #if @GNULIB_PTHREAD_THREAD@
685 # if @REPLACE_PTHREAD_EXIT@
686 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
687 #   undef pthread_exit
688 #   define pthread_exit rpl_pthread_exit
689 #  endif
690 _GL_FUNCDECL_RPL (pthread_exit, _Noreturn void, (void *value));
691 _GL_CXXALIAS_RPL (pthread_exit, void, (void *value));
692 # else
693 #  if !@HAVE_PTHREAD_EXIT@
694 _GL_FUNCDECL_SYS (pthread_exit, _Noreturn void, (void *value));
695 #  endif
696 /* Need to cast because of AIX with xlclang++.  */
697 _GL_CXXALIAS_SYS_CAST (pthread_exit, void, (void *value));
698 # endif
699 _GL_CXXALIASWARN (pthread_exit);
700 #elif defined GNULIB_POSIXCHECK
701 # undef pthread_exit
702 # if HAVE_RAW_DECL_PTHREAD_EXIT
703 _GL_WARN_ON_USE (pthread_exit, "pthread_exit is not portable - "
704                  "use gnulib module pthread-thread for portability");
705 # endif
706 #endif
707 
708 /* =========== Once-only control (initialization) functions =========== */
709 
710 #if @GNULIB_PTHREAD_ONCE@
711 # if @REPLACE_PTHREAD_ONCE@
712 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
713 #   undef pthread_once
714 #   define pthread_once rpl_pthread_once
715 #  endif
716 _GL_FUNCDECL_RPL (pthread_once, int,
717                   (pthread_once_t *once_control, void (*initfunction) (void))
718                   _GL_ARG_NONNULL ((1, 2)));
719 _GL_CXXALIAS_RPL (pthread_once, int,
720                   (pthread_once_t *once_control, void (*initfunction) (void)));
721 # else
722 #  if !@HAVE_PTHREAD_ONCE@
723 _GL_FUNCDECL_SYS (pthread_once, int,
724                   (pthread_once_t *once_control, void (*initfunction) (void))
725                    _GL_ARG_NONNULL ((1, 2)));
726 #  endif
727 _GL_CXXALIAS_SYS_CAST (pthread_once, int,
728                        (pthread_once_t *once_control,
729                         void (*initfunction) (void)));
730 # endif
731 _GL_CXXALIASWARN (pthread_once);
732 #elif defined GNULIB_POSIXCHECK
733 # undef pthread_once
734 # if HAVE_RAW_DECL_PTHREAD_ONCE
735 _GL_WARN_ON_USE (pthread_once, "pthread_once is not portable - "
736                  "use gnulib module pthread-once for portability");
737 # endif
738 #endif
739 
740 /* =========== Mutex functions =========== */
741 
742 #if @GNULIB_PTHREAD_MUTEX@
743 # if @REPLACE_PTHREAD_MUTEX_INIT@
744 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
745 #   undef pthread_mutex_init
746 #   define pthread_mutex_init rpl_pthread_mutex_init
747 #  endif
748 _GL_FUNCDECL_RPL (pthread_mutex_init, int,
749                   (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
750                   _GL_ARG_NONNULL ((1)));
751 _GL_CXXALIAS_RPL (pthread_mutex_init, int,
752                   (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr));
753 # else
754 #  if !@HAVE_PTHREAD_MUTEX_INIT@
755 _GL_FUNCDECL_SYS (pthread_mutex_init, int,
756                   (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
757                   _GL_ARG_NONNULL ((1)));
758 #  endif
759 _GL_CXXALIAS_SYS (pthread_mutex_init, int,
760                   (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr));
761 # endif
762 _GL_CXXALIASWARN (pthread_mutex_init);
763 #elif defined GNULIB_POSIXCHECK
764 # undef pthread_mutex_init
765 # if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT
766 _GL_WARN_ON_USE (pthread_mutex_init, "pthread_mutex_init is not portable - "
767                  "use gnulib module pthread-mutex for portability");
768 # endif
769 #endif
770 
771 #if @GNULIB_PTHREAD_MUTEX@
772 # if @REPLACE_PTHREAD_MUTEXATTR_INIT@
773 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
774 #   undef pthread_mutexattr_init
775 #   define pthread_mutexattr_init rpl_pthread_mutexattr_init
776 #  endif
777 _GL_FUNCDECL_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)
778                                                _GL_ARG_NONNULL ((1)));
779 _GL_CXXALIAS_RPL (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
780 # else
781 #  if !@HAVE_PTHREAD_MUTEXATTR_INIT@
782 _GL_FUNCDECL_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr)
783                                                _GL_ARG_NONNULL ((1)));
784 #  endif
785 _GL_CXXALIAS_SYS (pthread_mutexattr_init, int, (pthread_mutexattr_t *attr));
786 # endif
787 _GL_CXXALIASWARN (pthread_mutexattr_init);
788 #elif defined GNULIB_POSIXCHECK
789 # undef pthread_mutexattr_init
790 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT
791 _GL_WARN_ON_USE (pthread_mutexattr_init, "pthread_mutexattr_init is not portable - "
792                  "use gnulib module pthread-mutex for portability");
793 # endif
794 #endif
795 
796 #if @GNULIB_PTHREAD_MUTEX@
797 # if @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@
798 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
799 #   undef pthread_mutexattr_gettype
800 #   define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype
801 #  endif
802 _GL_FUNCDECL_RPL (pthread_mutexattr_gettype, int,
803                   (const pthread_mutexattr_t *attr, int *typep)
804                   _GL_ARG_NONNULL ((1, 2)));
805 _GL_CXXALIAS_RPL (pthread_mutexattr_gettype, int,
806                   (const pthread_mutexattr_t *attr, int *typep));
807 # else
808 #  if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@
809 _GL_FUNCDECL_SYS (pthread_mutexattr_gettype, int,
810                   (const pthread_mutexattr_t *attr, int *typep)
811                   _GL_ARG_NONNULL ((1, 2)));
812 #  endif
813 /* Need to cast, because on FreeBSD the first parameter is
814                         pthread_mutexattr_t *attr.  */
815 _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype, int,
816                        (const pthread_mutexattr_t *attr, int *typep));
817 # endif
818 _GL_CXXALIASWARN (pthread_mutexattr_gettype);
819 #elif defined GNULIB_POSIXCHECK
820 # undef pthread_mutexattr_gettype
821 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE
822 _GL_WARN_ON_USE (pthread_mutexattr_gettype, "pthread_mutexattr_gettype is not portable - "
823                  "use gnulib module pthread-mutex for portability");
824 # endif
825 #endif
826 
827 #if @GNULIB_PTHREAD_MUTEX@
828 # if @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@
829 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
830 #   undef pthread_mutexattr_settype
831 #   define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
832 #  endif
833 _GL_FUNCDECL_RPL (pthread_mutexattr_settype, int,
834                   (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1)));
835 _GL_CXXALIAS_RPL (pthread_mutexattr_settype, int,
836                   (pthread_mutexattr_t *attr, int type));
837 # else
838 #  if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@
839 _GL_FUNCDECL_SYS (pthread_mutexattr_settype, int,
840                   (pthread_mutexattr_t *attr, int type) _GL_ARG_NONNULL ((1)));
841 #  endif
842 _GL_CXXALIAS_SYS (pthread_mutexattr_settype, int,
843                   (pthread_mutexattr_t *attr, int type));
844 # endif
845 _GL_CXXALIASWARN (pthread_mutexattr_settype);
846 #elif defined GNULIB_POSIXCHECK
847 # undef pthread_mutexattr_settype
848 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE
849 _GL_WARN_ON_USE (pthread_mutexattr_settype, "pthread_mutexattr_settype is not portable - "
850                  "use gnulib module pthread-mutex for portability");
851 # endif
852 #endif
853 
854 #if @GNULIB_PTHREAD_MUTEX@
855 # if @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@
856 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
857 #   undef pthread_mutexattr_getrobust
858 #   define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust
859 #  endif
860 _GL_FUNCDECL_RPL (pthread_mutexattr_getrobust, int,
861                   (const pthread_mutexattr_t *attr, int *robustp)
862                   _GL_ARG_NONNULL ((1, 2)));
863 _GL_CXXALIAS_RPL (pthread_mutexattr_getrobust, int,
864                   (const pthread_mutexattr_t *attr, int *robustp));
865 # else
866 #  if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@
867 _GL_FUNCDECL_SYS (pthread_mutexattr_getrobust, int,
868                   (const pthread_mutexattr_t *attr, int *robustp)
869                   _GL_ARG_NONNULL ((1, 2)));
870 #  endif
871 /* Need to cast, because on FreeBSD the first parameter is
872                         pthread_mutexattr_t *attr.  */
873 _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust, int,
874                        (const pthread_mutexattr_t *attr, int *robustp));
875 # endif
876 # if __GLIBC__ >= 2
877 _GL_CXXALIASWARN (pthread_mutexattr_getrobust);
878 # endif
879 #elif defined GNULIB_POSIXCHECK
880 # undef pthread_mutexattr_getrobust
881 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
882 _GL_WARN_ON_USE (pthread_mutexattr_getrobust, "pthread_mutexattr_getrobust is not portable - "
883                  "use gnulib module pthread-mutex for portability");
884 # endif
885 #endif
886 
887 #if @GNULIB_PTHREAD_MUTEX@
888 # if @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@
889 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
890 #   undef pthread_mutexattr_setrobust
891 #   define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
892 #  endif
893 _GL_FUNCDECL_RPL (pthread_mutexattr_setrobust, int,
894                   (pthread_mutexattr_t *attr, int robust)
895                   _GL_ARG_NONNULL ((1)));
896 _GL_CXXALIAS_RPL (pthread_mutexattr_setrobust, int,
897                   (pthread_mutexattr_t *attr, int robust));
898 # else
899 #  if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@
900 _GL_FUNCDECL_SYS (pthread_mutexattr_setrobust, int,
901                   (pthread_mutexattr_t *attr, int robust)
902                   _GL_ARG_NONNULL ((1)));
903 #  endif
904 _GL_CXXALIAS_SYS (pthread_mutexattr_setrobust, int,
905                   (pthread_mutexattr_t *attr, int robust));
906 # endif
907 # if __GLIBC__ >= 2
908 _GL_CXXALIASWARN (pthread_mutexattr_setrobust);
909 # endif
910 #elif defined GNULIB_POSIXCHECK
911 # undef pthread_mutexattr_setrobust
912 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
913 _GL_WARN_ON_USE (pthread_mutexattr_setrobust, "pthread_mutexattr_setrobust is not portable - "
914                  "use gnulib module pthread-mutex for portability");
915 # endif
916 #endif
917 
918 #if @GNULIB_PTHREAD_MUTEX@
919 # if @REPLACE_PTHREAD_MUTEXATTR_DESTROY@
920 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
921 #   undef pthread_mutexattr_destroy
922 #   define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
923 #  endif
924 _GL_FUNCDECL_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)
925                                                   _GL_ARG_NONNULL ((1)));
926 _GL_CXXALIAS_RPL (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
927 # else
928 #  if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@
929 _GL_FUNCDECL_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr)
930                                                   _GL_ARG_NONNULL ((1)));
931 #  endif
932 _GL_CXXALIAS_SYS (pthread_mutexattr_destroy, int, (pthread_mutexattr_t *attr));
933 # endif
934 _GL_CXXALIASWARN (pthread_mutexattr_destroy);
935 #elif defined GNULIB_POSIXCHECK
936 # undef pthread_mutexattr_destroy
937 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY
938 _GL_WARN_ON_USE (pthread_mutexattr_destroy, "pthread_mutexattr_destroy is not portable - "
939                  "use gnulib module pthread-mutex for portability");
940 # endif
941 #endif
942 
943 #if @GNULIB_PTHREAD_MUTEX@
944 # if @REPLACE_PTHREAD_MUTEX_LOCK@
945 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
946 #   undef pthread_mutex_lock
947 #   define pthread_mutex_lock rpl_pthread_mutex_lock
948 #  endif
949 _GL_FUNCDECL_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex)
950                                            _GL_ARG_NONNULL ((1)));
951 _GL_CXXALIAS_RPL (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
952 # else
953 #  if !@HAVE_PTHREAD_MUTEX_LOCK@
954 _GL_FUNCDECL_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex)
955                                            _GL_ARG_NONNULL ((1)));
956 #  endif
957 _GL_CXXALIAS_SYS (pthread_mutex_lock, int, (pthread_mutex_t *mutex));
958 # endif
959 # if __GLIBC__ >= 2
960 _GL_CXXALIASWARN (pthread_mutex_lock);
961 # endif
962 #elif defined GNULIB_POSIXCHECK
963 # undef pthread_mutex_lock
964 # if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
965 _GL_WARN_ON_USE (pthread_mutex_lock, "pthread_mutex_lock is not portable - "
966                  "use gnulib module pthread-mutex for portability");
967 # endif
968 #endif
969 
970 #if @GNULIB_PTHREAD_MUTEX@
971 # if @REPLACE_PTHREAD_MUTEX_TRYLOCK@
972 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
973 #   undef pthread_mutex_trylock
974 #   define pthread_mutex_trylock rpl_pthread_mutex_trylock
975 #  endif
976 _GL_FUNCDECL_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)
977                                               _GL_ARG_NONNULL ((1)));
978 _GL_CXXALIAS_RPL (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
979 # else
980 #  if !@HAVE_PTHREAD_MUTEX_TRYLOCK@
981 _GL_FUNCDECL_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex)
982                                               _GL_ARG_NONNULL ((1)));
983 #  endif
984 _GL_CXXALIAS_SYS (pthread_mutex_trylock, int, (pthread_mutex_t *mutex));
985 # endif
986 _GL_CXXALIASWARN (pthread_mutex_trylock);
987 #elif defined GNULIB_POSIXCHECK
988 # undef pthread_mutex_trylock
989 # if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK
990 _GL_WARN_ON_USE (pthread_mutex_trylock, "pthread_mutex_trylock is not portable - "
991                  "use gnulib module pthread-mutex for portability");
992 # endif
993 #endif
994 
995 #if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
996 # if @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@
997 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
998 #   undef pthread_mutex_timedlock
999 #   define pthread_mutex_timedlock rpl_pthread_mutex_timedlock
1000 #  endif
1001 _GL_FUNCDECL_RPL (pthread_mutex_timedlock, int,
1002                   (pthread_mutex_t *mutex, const struct timespec *abstime)
1003                   _GL_ARG_NONNULL ((1, 2)));
1004 _GL_CXXALIAS_RPL (pthread_mutex_timedlock, int,
1005                   (pthread_mutex_t *mutex, const struct timespec *abstime));
1006 # else
1007 #  if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@
1008 _GL_FUNCDECL_SYS (pthread_mutex_timedlock, int,
1009                   (pthread_mutex_t *mutex, const struct timespec *abstime)
1010                   _GL_ARG_NONNULL ((1, 2)));
1011 #  endif
1012 _GL_CXXALIAS_SYS (pthread_mutex_timedlock, int,
1013                   (pthread_mutex_t *mutex, const struct timespec *abstime));
1014 # endif
1015 _GL_CXXALIASWARN (pthread_mutex_timedlock);
1016 #elif defined GNULIB_POSIXCHECK
1017 # undef pthread_mutex_timedlock
1018 # if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK
1019 _GL_WARN_ON_USE (pthread_mutex_timedlock, "pthread_mutex_timedlock is not portable - "
1020                  "use gnulib module pthread_mutex_timedlock for portability");
1021 # endif
1022 #endif
1023 
1024 #if @GNULIB_PTHREAD_MUTEX@
1025 # if @REPLACE_PTHREAD_MUTEX_UNLOCK@
1026 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1027 #   undef pthread_mutex_unlock
1028 #   define pthread_mutex_unlock rpl_pthread_mutex_unlock
1029 #  endif
1030 _GL_FUNCDECL_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)
1031                                              _GL_ARG_NONNULL ((1)));
1032 _GL_CXXALIAS_RPL (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1033 # else
1034 #  if !@HAVE_PTHREAD_MUTEX_UNLOCK@
1035 _GL_FUNCDECL_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex)
1036                                              _GL_ARG_NONNULL ((1)));
1037 #  endif
1038 _GL_CXXALIAS_SYS (pthread_mutex_unlock, int, (pthread_mutex_t *mutex));
1039 # endif
1040 _GL_CXXALIASWARN (pthread_mutex_unlock);
1041 #elif defined GNULIB_POSIXCHECK
1042 # undef pthread_mutex_unlock
1043 # if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK
1044 _GL_WARN_ON_USE (pthread_mutex_unlock, "pthread_mutex_unlock is not portable - "
1045                  "use gnulib module pthread-mutex for portability");
1046 # endif
1047 #endif
1048 
1049 #if @GNULIB_PTHREAD_MUTEX@
1050 # if @REPLACE_PTHREAD_MUTEX_DESTROY@
1051 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1052 #   undef pthread_mutex_destroy
1053 #   define pthread_mutex_destroy rpl_pthread_mutex_destroy
1054 #  endif
1055 _GL_FUNCDECL_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)
1056                                               _GL_ARG_NONNULL ((1)));
1057 _GL_CXXALIAS_RPL (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1058 # else
1059 #  if !@HAVE_PTHREAD_MUTEX_DESTROY@
1060 _GL_FUNCDECL_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex)
1061                                               _GL_ARG_NONNULL ((1)));
1062 #  endif
1063 _GL_CXXALIAS_SYS (pthread_mutex_destroy, int, (pthread_mutex_t *mutex));
1064 # endif
1065 _GL_CXXALIASWARN (pthread_mutex_destroy);
1066 #elif defined GNULIB_POSIXCHECK
1067 # undef pthread_mutex_destroy
1068 # if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY
1069 _GL_WARN_ON_USE (pthread_mutex_destroy, "pthread_mutex_destroy is not portable - "
1070                  "use gnulib module pthread-mutex for portability");
1071 # endif
1072 #endif
1073 
1074 /* =========== Read-write lock functions =========== */
1075 
1076 #if @GNULIB_PTHREAD_RWLOCK@
1077 # if @REPLACE_PTHREAD_RWLOCK_INIT@
1078 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1079 #   undef pthread_rwlock_init
1080 #   define pthread_rwlock_init rpl_pthread_rwlock_init
1081 #  endif
1082 _GL_FUNCDECL_RPL (pthread_rwlock_init, int,
1083                   (pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr)
1084                   _GL_ARG_NONNULL ((1)));
1085 _GL_CXXALIAS_RPL (pthread_rwlock_init, int,
1086                   (pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr));
1087 # else
1088 #  if !@HAVE_PTHREAD_RWLOCK_INIT@
1089 _GL_FUNCDECL_SYS (pthread_rwlock_init, int,
1090                   (pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr)
1091                   _GL_ARG_NONNULL ((1)));
1092 #  endif
1093 _GL_CXXALIAS_SYS (pthread_rwlock_init, int,
1094                   (pthread_rwlock_t *lock, const pthread_rwlockattr_t *attr));
1095 # endif
1096 _GL_CXXALIASWARN (pthread_rwlock_init);
1097 #elif defined GNULIB_POSIXCHECK
1098 # undef pthread_rwlock_init
1099 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT
1100 _GL_WARN_ON_USE (pthread_rwlock_init, "pthread_rwlock_init is not portable - "
1101                  "use gnulib module pthread-rwlock for portability");
1102 # endif
1103 #endif
1104 
1105 #if @GNULIB_PTHREAD_RWLOCK@
1106 # if @REPLACE_PTHREAD_RWLOCKATTR_INIT@
1107 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1108 #   undef pthread_rwlockattr_init
1109 #   define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
1110 #  endif
1111 _GL_FUNCDECL_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)
1112                                                 _GL_ARG_NONNULL ((1)));
1113 _GL_CXXALIAS_RPL (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1114 # else
1115 #  if !@HAVE_PTHREAD_RWLOCKATTR_INIT@
1116 _GL_FUNCDECL_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr)
1117                                                 _GL_ARG_NONNULL ((1)));
1118 #  endif
1119 _GL_CXXALIAS_SYS (pthread_rwlockattr_init, int, (pthread_rwlockattr_t *attr));
1120 # endif
1121 _GL_CXXALIASWARN (pthread_rwlockattr_init);
1122 #elif defined GNULIB_POSIXCHECK
1123 # undef pthread_rwlockattr_init
1124 # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT
1125 _GL_WARN_ON_USE (pthread_rwlockattr_init, "pthread_rwlockattr_init is not portable - "
1126                  "use gnulib module pthread-rwlock for portability");
1127 # endif
1128 #endif
1129 
1130 #if @GNULIB_PTHREAD_RWLOCK@
1131 # if @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@
1132 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1133 #   undef pthread_rwlockattr_destroy
1134 #   define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
1135 #  endif
1136 _GL_FUNCDECL_RPL (pthread_rwlockattr_destroy, int,
1137                   (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1)));
1138 _GL_CXXALIAS_RPL (pthread_rwlockattr_destroy, int,
1139                   (pthread_rwlockattr_t *attr));
1140 # else
1141 #  if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@
1142 _GL_FUNCDECL_SYS (pthread_rwlockattr_destroy, int,
1143                   (pthread_rwlockattr_t *attr) _GL_ARG_NONNULL ((1)));
1144 #  endif
1145 _GL_CXXALIAS_SYS (pthread_rwlockattr_destroy, int,
1146                   (pthread_rwlockattr_t *attr));
1147 # endif
1148 _GL_CXXALIASWARN (pthread_rwlockattr_destroy);
1149 #elif defined GNULIB_POSIXCHECK
1150 # undef pthread_rwlockattr_destroy
1151 # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY
1152 _GL_WARN_ON_USE (pthread_rwlockattr_destroy, "pthread_rwlockattr_destroy is not portable - "
1153                  "use gnulib module pthread-rwlock for portability");
1154 # endif
1155 #endif
1156 
1157 #if @GNULIB_PTHREAD_RWLOCK@
1158 # if @REPLACE_PTHREAD_RWLOCK_RDLOCK@
1159 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1160 #   undef pthread_rwlock_rdlock
1161 #   define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
1162 #  endif
1163 _GL_FUNCDECL_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)
1164                                               _GL_ARG_NONNULL ((1)));
1165 _GL_CXXALIAS_RPL (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1166 # else
1167 #  if !@HAVE_PTHREAD_RWLOCK_RDLOCK@
1168 _GL_FUNCDECL_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock)
1169                                               _GL_ARG_NONNULL ((1)));
1170 #  endif
1171 _GL_CXXALIAS_SYS (pthread_rwlock_rdlock, int, (pthread_rwlock_t *lock));
1172 # endif
1173 _GL_CXXALIASWARN (pthread_rwlock_rdlock);
1174 #elif defined GNULIB_POSIXCHECK
1175 # undef pthread_rwlock_rdlock
1176 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK
1177 _GL_WARN_ON_USE (pthread_rwlock_rdlock, "pthread_rwlock_rdlock is not portable - "
1178                  "use gnulib module pthread-rwlock for portability");
1179 # endif
1180 #endif
1181 
1182 #if @GNULIB_PTHREAD_RWLOCK@
1183 # if @REPLACE_PTHREAD_RWLOCK_WRLOCK@
1184 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1185 #   undef pthread_rwlock_wrlock
1186 #   define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
1187 #  endif
1188 _GL_FUNCDECL_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)
1189                                               _GL_ARG_NONNULL ((1)));
1190 _GL_CXXALIAS_RPL (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1191 # else
1192 #  if !@HAVE_PTHREAD_RWLOCK_WRLOCK@
1193 _GL_FUNCDECL_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock)
1194                                               _GL_ARG_NONNULL ((1)));
1195 #  endif
1196 _GL_CXXALIAS_SYS (pthread_rwlock_wrlock, int, (pthread_rwlock_t *lock));
1197 # endif
1198 _GL_CXXALIASWARN (pthread_rwlock_wrlock);
1199 #elif defined GNULIB_POSIXCHECK
1200 # undef pthread_rwlock_wrlock
1201 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK
1202 _GL_WARN_ON_USE (pthread_rwlock_wrlock, "pthread_rwlock_wrlock is not portable - "
1203                  "use gnulib module pthread-rwlock for portability");
1204 # endif
1205 #endif
1206 
1207 #if @GNULIB_PTHREAD_RWLOCK@
1208 # if @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@
1209 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1210 #   undef pthread_rwlock_tryrdlock
1211 #   define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
1212 #  endif
1213 _GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)
1214                                                  _GL_ARG_NONNULL ((1)));
1215 _GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1216 # else
1217 #  if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
1218 _GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock)
1219                                                  _GL_ARG_NONNULL ((1)));
1220 #  endif
1221 _GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock, int, (pthread_rwlock_t *lock));
1222 # endif
1223 _GL_CXXALIASWARN (pthread_rwlock_tryrdlock);
1224 #elif defined GNULIB_POSIXCHECK
1225 # undef pthread_rwlock_tryrdlock
1226 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK
1227 _GL_WARN_ON_USE (pthread_rwlock_tryrdlock, "pthread_rwlock_tryrdlock is not portable - "
1228                  "use gnulib module pthread-rwlock for portability");
1229 # endif
1230 #endif
1231 
1232 #if @GNULIB_PTHREAD_RWLOCK@
1233 # if @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@
1234 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1235 #   undef pthread_rwlock_trywrlock
1236 #   define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
1237 #  endif
1238 _GL_FUNCDECL_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)
1239                                                  _GL_ARG_NONNULL ((1)));
1240 _GL_CXXALIAS_RPL (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1241 # else
1242 #  if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
1243 _GL_FUNCDECL_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock)
1244                                                  _GL_ARG_NONNULL ((1)));
1245 #  endif
1246 _GL_CXXALIAS_SYS (pthread_rwlock_trywrlock, int, (pthread_rwlock_t *lock));
1247 # endif
1248 _GL_CXXALIASWARN (pthread_rwlock_trywrlock);
1249 #elif defined GNULIB_POSIXCHECK
1250 # undef pthread_rwlock_trywrlock
1251 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK
1252 _GL_WARN_ON_USE (pthread_rwlock_trywrlock, "pthread_rwlock_trywrlock is not portable - "
1253                  "use gnulib module pthread-rwlock for portability");
1254 # endif
1255 #endif
1256 
1257 #if @GNULIB_PTHREAD_RWLOCK@
1258 # if @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1259 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1260 #   undef pthread_rwlock_timedrdlock
1261 #   define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock
1262 #  endif
1263 _GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock, int,
1264                   (pthread_rwlock_t *lock, const struct timespec *abstime)
1265                   _GL_ARG_NONNULL ((1, 2)));
1266 _GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock, int,
1267                   (pthread_rwlock_t *lock, const struct timespec *abstime));
1268 # else
1269 #  if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1270 _GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock, int,
1271                   (pthread_rwlock_t *lock, const struct timespec *abstime)
1272                   _GL_ARG_NONNULL ((1, 2)));
1273 #  endif
1274 _GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock, int,
1275                   (pthread_rwlock_t *lock, const struct timespec *abstime));
1276 # endif
1277 _GL_CXXALIASWARN (pthread_rwlock_timedrdlock);
1278 #elif defined GNULIB_POSIXCHECK
1279 # undef pthread_rwlock_timedrdlock
1280 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK
1281 _GL_WARN_ON_USE (pthread_rwlock_timedrdlock, "pthread_rwlock_timedrdlock is not portable - "
1282                  "use gnulib module pthread-rwlock for portability");
1283 # endif
1284 #endif
1285 
1286 #if @GNULIB_PTHREAD_RWLOCK@
1287 # if @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1288 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1289 #   undef pthread_rwlock_timedwrlock
1290 #   define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock
1291 #  endif
1292 _GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock, int,
1293                   (pthread_rwlock_t *lock, const struct timespec *abstime)
1294                   _GL_ARG_NONNULL ((1, 2)));
1295 _GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock, int,
1296                   (pthread_rwlock_t *lock, const struct timespec *abstime));
1297 # else
1298 #  if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1299 _GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock, int,
1300                   (pthread_rwlock_t *lock, const struct timespec *abstime)
1301                   _GL_ARG_NONNULL ((1, 2)));
1302 #  endif
1303 _GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock, int,
1304                   (pthread_rwlock_t *lock, const struct timespec *abstime));
1305 # endif
1306 _GL_CXXALIASWARN (pthread_rwlock_timedwrlock);
1307 #elif defined GNULIB_POSIXCHECK
1308 # undef pthread_rwlock_timedwrlock
1309 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK
1310 _GL_WARN_ON_USE (pthread_rwlock_timedwrlock, "pthread_rwlock_timedwrlock is not portable - "
1311                  "use gnulib module pthread-rwlock for portability");
1312 # endif
1313 #endif
1314 
1315 #if @GNULIB_PTHREAD_RWLOCK@
1316 # if @REPLACE_PTHREAD_RWLOCK_UNLOCK@
1317 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1318 #   undef pthread_rwlock_unlock
1319 #   define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
1320 #  endif
1321 _GL_FUNCDECL_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)
1322                                               _GL_ARG_NONNULL ((1)));
1323 _GL_CXXALIAS_RPL (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
1324 # else
1325 #  if !@HAVE_PTHREAD_RWLOCK_UNLOCK@
1326 _GL_FUNCDECL_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock)
1327                                               _GL_ARG_NONNULL ((1)));
1328 #  endif
1329 _GL_CXXALIAS_SYS (pthread_rwlock_unlock, int, (pthread_rwlock_t *lock));
1330 # endif
1331 _GL_CXXALIASWARN (pthread_rwlock_unlock);
1332 #elif defined GNULIB_POSIXCHECK
1333 # undef pthread_rwlock_unlock
1334 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK
1335 _GL_WARN_ON_USE (pthread_rwlock_unlock, "pthread_rwlock_unlock is not portable - "
1336                  "use gnulib module pthread-rwlock for portability");
1337 # endif
1338 #endif
1339 
1340 #if @GNULIB_PTHREAD_RWLOCK@
1341 # if @REPLACE_PTHREAD_RWLOCK_DESTROY@
1342 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1343 #   undef pthread_rwlock_destroy
1344 #   define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
1345 #  endif
1346 _GL_FUNCDECL_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)
1347                                                _GL_ARG_NONNULL ((1)));
1348 _GL_CXXALIAS_RPL (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
1349 # else
1350 #  if !@HAVE_PTHREAD_RWLOCK_DESTROY@
1351 _GL_FUNCDECL_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock)
1352                                                _GL_ARG_NONNULL ((1)));
1353 #  endif
1354 _GL_CXXALIAS_SYS (pthread_rwlock_destroy, int, (pthread_rwlock_t *lock));
1355 # endif
1356 _GL_CXXALIASWARN (pthread_rwlock_destroy);
1357 #elif defined GNULIB_POSIXCHECK
1358 # undef pthread_rwlock_destroy
1359 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY
1360 _GL_WARN_ON_USE (pthread_rwlock_destroy, "pthread_rwlock_destroy is not portable - "
1361                  "use gnulib module pthread-rwlock for portability");
1362 # endif
1363 #endif
1364 
1365 /* =========== Condition variable functions =========== */
1366 
1367 #if @GNULIB_PTHREAD_COND@
1368 # if @REPLACE_PTHREAD_COND_INIT@
1369 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1370 #   undef pthread_cond_init
1371 #   define pthread_cond_init rpl_pthread_cond_init
1372 #  endif
1373 _GL_FUNCDECL_RPL (pthread_cond_init, int,
1374                   (pthread_cond_t *cond, const pthread_condattr_t *attr)
1375                   _GL_ARG_NONNULL ((1)));
1376 _GL_CXXALIAS_RPL (pthread_cond_init, int,
1377                   (pthread_cond_t *cond, const pthread_condattr_t *attr));
1378 # else
1379 #  if !@HAVE_PTHREAD_COND_INIT@
1380 _GL_FUNCDECL_SYS (pthread_cond_init, int,
1381                   (pthread_cond_t *cond, const pthread_condattr_t *attr)
1382                   _GL_ARG_NONNULL ((1)));
1383 #  endif
1384 _GL_CXXALIAS_SYS (pthread_cond_init, int,
1385                   (pthread_cond_t *cond, const pthread_condattr_t *attr));
1386 # endif
1387 _GL_CXXALIASWARN (pthread_cond_init);
1388 #elif defined GNULIB_POSIXCHECK
1389 # undef pthread_cond_init
1390 # if HAVE_RAW_DECL_PTHREAD_COND_INIT
1391 _GL_WARN_ON_USE (pthread_cond_init, "pthread_cond_init is not portable - "
1392                  "use gnulib module pthread-cond for portability");
1393 # endif
1394 #endif
1395 
1396 #if @GNULIB_PTHREAD_COND@
1397 # if @REPLACE_PTHREAD_CONDATTR_INIT@
1398 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1399 #   undef pthread_condattr_init
1400 #   define pthread_condattr_init rpl_pthread_condattr_init
1401 #  endif
1402 _GL_FUNCDECL_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr)
1403                                               _GL_ARG_NONNULL ((1)));
1404 _GL_CXXALIAS_RPL (pthread_condattr_init, int, (pthread_condattr_t *attr));
1405 # else
1406 #  if !@HAVE_PTHREAD_CONDATTR_INIT@
1407 _GL_FUNCDECL_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr)
1408                                               _GL_ARG_NONNULL ((1)));
1409 #  endif
1410 _GL_CXXALIAS_SYS (pthread_condattr_init, int, (pthread_condattr_t *attr));
1411 # endif
1412 _GL_CXXALIASWARN (pthread_condattr_init);
1413 #elif defined GNULIB_POSIXCHECK
1414 # undef pthread_condattr_init
1415 # if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT
1416 _GL_WARN_ON_USE (pthread_condattr_init, "pthread_condattr_init is not portable - "
1417                  "use gnulib module pthread-cond for portability");
1418 # endif
1419 #endif
1420 
1421 #if @GNULIB_PTHREAD_COND@
1422 # if @REPLACE_PTHREAD_CONDATTR_DESTROY@
1423 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1424 #   undef pthread_condattr_destroy
1425 #   define pthread_condattr_destroy rpl_pthread_condattr_destroy
1426 #  endif
1427 _GL_FUNCDECL_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr)
1428                                                  _GL_ARG_NONNULL ((1)));
1429 _GL_CXXALIAS_RPL (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
1430 # else
1431 #  if !@HAVE_PTHREAD_CONDATTR_DESTROY@
1432 _GL_FUNCDECL_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr)
1433                                                  _GL_ARG_NONNULL ((1)));
1434 #  endif
1435 _GL_CXXALIAS_SYS (pthread_condattr_destroy, int, (pthread_condattr_t *attr));
1436 # endif
1437 _GL_CXXALIASWARN (pthread_condattr_destroy);
1438 #elif defined GNULIB_POSIXCHECK
1439 # undef pthread_condattr_destroy
1440 # if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY
1441 _GL_WARN_ON_USE (pthread_condattr_destroy, "pthread_condattr_destroy is not portable - "
1442                  "use gnulib module pthread-cond for portability");
1443 # endif
1444 #endif
1445 
1446 #if @GNULIB_PTHREAD_COND@
1447 # if @REPLACE_PTHREAD_COND_WAIT@
1448 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1449 #   undef pthread_cond_wait
1450 #   define pthread_cond_wait rpl_pthread_cond_wait
1451 #  endif
1452 _GL_FUNCDECL_RPL (pthread_cond_wait, int,
1453                   (pthread_cond_t *cond, pthread_mutex_t *mutex)
1454                   _GL_ARG_NONNULL ((1, 2)));
1455 _GL_CXXALIAS_RPL (pthread_cond_wait, int,
1456                   (pthread_cond_t *cond, pthread_mutex_t *mutex));
1457 # else
1458 #  if !@HAVE_PTHREAD_COND_WAIT@
1459 _GL_FUNCDECL_SYS (pthread_cond_wait, int,
1460                   (pthread_cond_t *cond, pthread_mutex_t *mutex)
1461                   _GL_ARG_NONNULL ((1, 2)));
1462 #  endif
1463 _GL_CXXALIAS_SYS (pthread_cond_wait, int,
1464                   (pthread_cond_t *cond, pthread_mutex_t *mutex));
1465 # endif
1466 _GL_CXXALIASWARN (pthread_cond_wait);
1467 #elif defined GNULIB_POSIXCHECK
1468 # undef pthread_cond_wait
1469 # if HAVE_RAW_DECL_PTHREAD_COND_WAIT
1470 _GL_WARN_ON_USE (pthread_cond_wait, "pthread_cond_wait is not portable - "
1471                  "use gnulib module pthread-cond for portability");
1472 # endif
1473 #endif
1474 
1475 #if @GNULIB_PTHREAD_COND@
1476 # if @REPLACE_PTHREAD_COND_TIMEDWAIT@
1477 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1478 #   undef pthread_cond_timedwait
1479 #   define pthread_cond_timedwait rpl_pthread_cond_timedwait
1480 #  endif
1481 _GL_FUNCDECL_RPL (pthread_cond_timedwait, int,
1482                   (pthread_cond_t *cond, pthread_mutex_t *mutex,
1483                    const struct timespec *abstime)
1484                   _GL_ARG_NONNULL ((1, 2, 3)));
1485 _GL_CXXALIAS_RPL (pthread_cond_timedwait, int,
1486                   (pthread_cond_t *cond, pthread_mutex_t *mutex,
1487                    const struct timespec *abstime));
1488 # else
1489 #  if !@HAVE_PTHREAD_COND_TIMEDWAIT@
1490 _GL_FUNCDECL_SYS (pthread_cond_timedwait, int,
1491                   (pthread_cond_t *cond, pthread_mutex_t *mutex,
1492                    const struct timespec *abstime)
1493                   _GL_ARG_NONNULL ((1, 2, 3)));
1494 #  endif
1495 _GL_CXXALIAS_SYS (pthread_cond_timedwait, int,
1496                   (pthread_cond_t *cond, pthread_mutex_t *mutex,
1497                    const struct timespec *abstime));
1498 # endif
1499 _GL_CXXALIASWARN (pthread_cond_timedwait);
1500 #elif defined GNULIB_POSIXCHECK
1501 # undef pthread_cond_timedwait
1502 # if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT
1503 _GL_WARN_ON_USE (pthread_cond_timedwait, "pthread_cond_timedwait 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_COND_SIGNAL@
1510 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1511 #   undef pthread_cond_signal
1512 #   define pthread_cond_signal rpl_pthread_cond_signal
1513 #  endif
1514 _GL_FUNCDECL_RPL (pthread_cond_signal, int, (pthread_cond_t *cond)
1515                                             _GL_ARG_NONNULL ((1)));
1516 _GL_CXXALIAS_RPL (pthread_cond_signal, int, (pthread_cond_t *cond));
1517 # else
1518 #  if !@HAVE_PTHREAD_COND_SIGNAL@
1519 _GL_FUNCDECL_SYS (pthread_cond_signal, int, (pthread_cond_t *cond)
1520                                             _GL_ARG_NONNULL ((1)));
1521 #  endif
1522 _GL_CXXALIAS_SYS (pthread_cond_signal, int, (pthread_cond_t *cond));
1523 # endif
1524 _GL_CXXALIASWARN (pthread_cond_signal);
1525 #elif defined GNULIB_POSIXCHECK
1526 # undef pthread_cond_signal
1527 # if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL
1528 _GL_WARN_ON_USE (pthread_cond_signal, "pthread_cond_signal is not portable - "
1529                  "use gnulib module pthread-cond for portability");
1530 # endif
1531 #endif
1532 
1533 #if @GNULIB_PTHREAD_COND@
1534 # if @REPLACE_PTHREAD_COND_BROADCAST@
1535 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1536 #   undef pthread_cond_broadcast
1537 #   define pthread_cond_broadcast rpl_pthread_cond_broadcast
1538 #  endif
1539 _GL_FUNCDECL_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond)
1540                                                _GL_ARG_NONNULL ((1)));
1541 _GL_CXXALIAS_RPL (pthread_cond_broadcast, int, (pthread_cond_t *cond));
1542 # else
1543 #  if !@HAVE_PTHREAD_COND_BROADCAST@
1544 _GL_FUNCDECL_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond)
1545                                                _GL_ARG_NONNULL ((1)));
1546 #  endif
1547 _GL_CXXALIAS_SYS (pthread_cond_broadcast, int, (pthread_cond_t *cond));
1548 # endif
1549 _GL_CXXALIASWARN (pthread_cond_broadcast);
1550 #elif defined GNULIB_POSIXCHECK
1551 # undef pthread_cond_broadcast
1552 # if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST
1553 _GL_WARN_ON_USE (pthread_cond_broadcast, "pthread_cond_broadcast is not portable - "
1554                  "use gnulib module pthread-cond for portability");
1555 # endif
1556 #endif
1557 
1558 #if @GNULIB_PTHREAD_COND@
1559 # if @REPLACE_PTHREAD_COND_DESTROY@
1560 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1561 #   undef pthread_cond_destroy
1562 #   define pthread_cond_destroy rpl_pthread_cond_destroy
1563 #  endif
1564 _GL_FUNCDECL_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond)
1565                                              _GL_ARG_NONNULL ((1)));
1566 _GL_CXXALIAS_RPL (pthread_cond_destroy, int, (pthread_cond_t *cond));
1567 # else
1568 #  if !@HAVE_PTHREAD_COND_DESTROY@
1569 _GL_FUNCDECL_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond)
1570                                              _GL_ARG_NONNULL ((1)));
1571 #  endif
1572 _GL_CXXALIAS_SYS (pthread_cond_destroy, int, (pthread_cond_t *cond));
1573 # endif
1574 _GL_CXXALIASWARN (pthread_cond_destroy);
1575 #elif defined GNULIB_POSIXCHECK
1576 # undef pthread_cond_destroy
1577 # if HAVE_RAW_DECL_PTHREAD_COND_DESTROY
1578 _GL_WARN_ON_USE (pthread_cond_destroy, "pthread_cond_destroy is not portable - "
1579                  "use gnulib module pthread-cond for portability");
1580 # endif
1581 #endif
1582 
1583 /* =========== Thread-specific storage functions =========== */
1584 
1585 #if @GNULIB_PTHREAD_TSS@
1586 # if @REPLACE_PTHREAD_KEY_CREATE@
1587 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1588 #   undef pthread_key_create
1589 #   define pthread_key_create rpl_pthread_key_create
1590 #  endif
1591 _GL_FUNCDECL_RPL (pthread_key_create, int,
1592                   (pthread_key_t *keyp, void (*destructor) (void *))
1593                   _GL_ARG_NONNULL ((1)));
1594 _GL_CXXALIAS_RPL (pthread_key_create, int,
1595                   (pthread_key_t *keyp, void (*destructor) (void *)));
1596 # else
1597 #  if !@HAVE_PTHREAD_KEY_CREATE@
1598 _GL_FUNCDECL_SYS (pthread_key_create, int,
1599                   (pthread_key_t *keyp, void (*destructor) (void *))
1600                   _GL_ARG_NONNULL ((1)));
1601 #  endif
1602 _GL_CXXALIAS_SYS_CAST (pthread_key_create, int,
1603                        (pthread_key_t *keyp, void (*destructor) (void *)));
1604 # endif
1605 _GL_CXXALIASWARN (pthread_key_create);
1606 #elif defined GNULIB_POSIXCHECK
1607 # undef pthread_key_create
1608 # if HAVE_RAW_DECL_PTHREAD_KEY_CREATE
1609 _GL_WARN_ON_USE (pthread_key_create, "pthread_key_create is not portable - "
1610                  "use gnulib module pthread-tss for portability");
1611 # endif
1612 #endif
1613 
1614 #if @GNULIB_PTHREAD_TSS@
1615 # if @REPLACE_PTHREAD_SETSPECIFIC@
1616 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1617 #   undef pthread_setspecific
1618 #   define pthread_setspecific rpl_pthread_setspecific
1619 #  endif
1620 _GL_FUNCDECL_RPL (pthread_setspecific, int,
1621                   (pthread_key_t key, const void *value));
1622 _GL_CXXALIAS_RPL (pthread_setspecific, int,
1623                   (pthread_key_t key, const void *value));
1624 # else
1625 #  if !@HAVE_PTHREAD_SETSPECIFIC@
1626 _GL_FUNCDECL_SYS (pthread_setspecific, int,
1627                   (pthread_key_t key, const void *value));
1628 #  endif
1629 _GL_CXXALIAS_SYS (pthread_setspecific, int,
1630                   (pthread_key_t key, const void *value));
1631 # endif
1632 _GL_CXXALIASWARN (pthread_setspecific);
1633 #elif defined GNULIB_POSIXCHECK
1634 # undef pthread_setspecific
1635 # if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC
1636 _GL_WARN_ON_USE (pthread_setspecific, "pthread_setspecific is not portable - "
1637                  "use gnulib module pthread-tss for portability");
1638 # endif
1639 #endif
1640 
1641 #if @GNULIB_PTHREAD_TSS@
1642 # if @REPLACE_PTHREAD_GETSPECIFIC@
1643 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1644 #   undef pthread_getspecific
1645 #   define pthread_getspecific rpl_pthread_getspecific
1646 #  endif
1647 _GL_FUNCDECL_RPL (pthread_getspecific, void *, (pthread_key_t key));
1648 _GL_CXXALIAS_RPL (pthread_getspecific, void *, (pthread_key_t key));
1649 # else
1650 #  if !@HAVE_PTHREAD_GETSPECIFIC@
1651 _GL_FUNCDECL_SYS (pthread_getspecific, void *, (pthread_key_t key));
1652 #  endif
1653 _GL_CXXALIAS_SYS (pthread_getspecific, void *, (pthread_key_t key));
1654 # endif
1655 _GL_CXXALIASWARN (pthread_getspecific);
1656 #elif defined GNULIB_POSIXCHECK
1657 # undef pthread_getspecific
1658 # if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC
1659 _GL_WARN_ON_USE (pthread_getspecific, "pthread_getspecific is not portable - "
1660                  "use gnulib module pthread-tss for portability");
1661 # endif
1662 #endif
1663 
1664 #if @GNULIB_PTHREAD_TSS@
1665 # if @REPLACE_PTHREAD_KEY_DELETE@
1666 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1667 #   undef pthread_key_delete
1668 #   define pthread_key_delete rpl_pthread_key_delete
1669 #  endif
1670 _GL_FUNCDECL_RPL (pthread_key_delete, int, (pthread_key_t key));
1671 _GL_CXXALIAS_RPL (pthread_key_delete, int, (pthread_key_t key));
1672 # else
1673 #  if !@HAVE_PTHREAD_KEY_DELETE@
1674 _GL_FUNCDECL_SYS (pthread_key_delete, int, (pthread_key_t key));
1675 #  endif
1676 _GL_CXXALIAS_SYS (pthread_key_delete, int, (pthread_key_t key));
1677 # endif
1678 _GL_CXXALIASWARN (pthread_key_delete);
1679 #elif defined GNULIB_POSIXCHECK
1680 # undef pthread_key_delete
1681 # if HAVE_RAW_DECL_PTHREAD_KEY_DELETE
1682 _GL_WARN_ON_USE (pthread_key_delete, "pthread_key_delete is not portable - "
1683                  "use gnulib module pthread-tss for portability");
1684 # endif
1685 #endif
1686 
1687 /* =========== Spinlock functions =========== */
1688 
1689 #if @GNULIB_PTHREAD_SPIN@
1690 # if @REPLACE_PTHREAD_SPIN_INIT@
1691 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1692 #   undef pthread_spin_init
1693 #   define pthread_spin_init rpl_pthread_spin_init
1694 #  endif
1695 _GL_FUNCDECL_RPL (pthread_spin_init, int,
1696                   (pthread_spinlock_t *lock, int shared_across_processes)
1697                   _GL_ARG_NONNULL ((1)));
1698 _GL_CXXALIAS_RPL (pthread_spin_init, int,
1699                   (pthread_spinlock_t *lock, int shared_across_processes));
1700 # else
1701 #  if !@HAVE_PTHREAD_SPIN_INIT@
1702 _GL_FUNCDECL_SYS (pthread_spin_init, int,
1703                   (pthread_spinlock_t *lock, int shared_across_processes)
1704                   _GL_ARG_NONNULL ((1)));
1705 #  endif
1706 _GL_CXXALIAS_SYS (pthread_spin_init, int,
1707                   (pthread_spinlock_t *lock, int shared_across_processes));
1708 # endif
1709 # if __GLIBC__ >= 2
1710 _GL_CXXALIASWARN (pthread_spin_init);
1711 # endif
1712 #elif defined GNULIB_POSIXCHECK
1713 # undef pthread_spin_init
1714 # if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
1715 _GL_WARN_ON_USE (pthread_spin_init, "pthread_spin_init is not portable - "
1716                  "use gnulib module pthread-spin for portability");
1717 # endif
1718 #endif
1719 
1720 #if @GNULIB_PTHREAD_SPIN@
1721 # if @REPLACE_PTHREAD_SPIN_LOCK@
1722 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1723 #   undef pthread_spin_lock
1724 #   define pthread_spin_lock rpl_pthread_spin_lock
1725 #  endif
1726 _GL_FUNCDECL_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock)
1727                                           _GL_ARG_NONNULL ((1)));
1728 _GL_CXXALIAS_RPL (pthread_spin_lock, int, (pthread_spinlock_t *lock));
1729 # else
1730 #  if !@HAVE_PTHREAD_SPIN_LOCK@
1731 _GL_FUNCDECL_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock)
1732                                           _GL_ARG_NONNULL ((1)));
1733 #  endif
1734 _GL_CXXALIAS_SYS (pthread_spin_lock, int, (pthread_spinlock_t *lock));
1735 # endif
1736 # if __GLIBC__ >= 2
1737 _GL_CXXALIASWARN (pthread_spin_lock);
1738 # endif
1739 #elif defined GNULIB_POSIXCHECK
1740 # undef pthread_spin_lock
1741 # if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
1742 _GL_WARN_ON_USE (pthread_spin_lock, "pthread_spin_lock is not portable - "
1743                  "use gnulib module pthread-spin for portability");
1744 # endif
1745 #endif
1746 
1747 #if @GNULIB_PTHREAD_SPIN@
1748 # if @REPLACE_PTHREAD_SPIN_TRYLOCK@
1749 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1750 #   undef pthread_spin_trylock
1751 #   define pthread_spin_trylock rpl_pthread_spin_trylock
1752 #  endif
1753 _GL_FUNCDECL_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock)
1754                                              _GL_ARG_NONNULL ((1)));
1755 _GL_CXXALIAS_RPL (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
1756 # else
1757 #  if !@HAVE_PTHREAD_SPIN_TRYLOCK@
1758 _GL_FUNCDECL_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock)
1759                                              _GL_ARG_NONNULL ((1)));
1760 #  endif
1761 _GL_CXXALIAS_SYS (pthread_spin_trylock, int, (pthread_spinlock_t *lock));
1762 # endif
1763 # if __GLIBC__ >= 2
1764 _GL_CXXALIASWARN (pthread_spin_trylock);
1765 # endif
1766 #elif defined GNULIB_POSIXCHECK
1767 # undef pthread_spin_trylock
1768 # if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
1769 _GL_WARN_ON_USE (pthread_spin_trylock, "pthread_spin_trylock is not portable - "
1770                  "use gnulib module pthread-spin for portability");
1771 # endif
1772 #endif
1773 
1774 #if @GNULIB_PTHREAD_SPIN@
1775 # if @REPLACE_PTHREAD_SPIN_UNLOCK@
1776 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1777 #   undef pthread_spin_unlock
1778 #   define pthread_spin_unlock rpl_pthread_spin_unlock
1779 #  endif
1780 _GL_FUNCDECL_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock)
1781                                             _GL_ARG_NONNULL ((1)));
1782 _GL_CXXALIAS_RPL (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
1783 # else
1784 #  if !@HAVE_PTHREAD_SPIN_UNLOCK@
1785 _GL_FUNCDECL_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock)
1786                                             _GL_ARG_NONNULL ((1)));
1787 #  endif
1788 _GL_CXXALIAS_SYS (pthread_spin_unlock, int, (pthread_spinlock_t *lock));
1789 # endif
1790 # if __GLIBC__ >= 2
1791 _GL_CXXALIASWARN (pthread_spin_unlock);
1792 # endif
1793 #elif defined GNULIB_POSIXCHECK
1794 # undef pthread_spin_unlock
1795 # if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
1796 _GL_WARN_ON_USE (pthread_spin_unlock, "pthread_spin_unlock is not portable - "
1797                  "use gnulib module pthread-spin for portability");
1798 # endif
1799 #endif
1800 
1801 #if @GNULIB_PTHREAD_SPIN@
1802 # if @REPLACE_PTHREAD_SPIN_DESTROY@
1803 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1804 #   undef pthread_spin_destroy
1805 #   define pthread_spin_destroy rpl_pthread_spin_destroy
1806 #  endif
1807 _GL_FUNCDECL_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock)
1808                                              _GL_ARG_NONNULL ((1)));
1809 _GL_CXXALIAS_RPL (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
1810 # else
1811 #  if !@HAVE_PTHREAD_SPIN_DESTROY@
1812 _GL_FUNCDECL_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock)
1813                                              _GL_ARG_NONNULL ((1)));
1814 #  endif
1815 _GL_CXXALIAS_SYS (pthread_spin_destroy, int, (pthread_spinlock_t *lock));
1816 # endif
1817 # if __GLIBC__ >= 2
1818 _GL_CXXALIASWARN (pthread_spin_destroy);
1819 # endif
1820 #elif defined GNULIB_POSIXCHECK
1821 # undef pthread_spin_destroy
1822 # if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
1823 _GL_WARN_ON_USE (pthread_spin_destroy, "pthread_spin_destroy is not portable - "
1824                  "use gnulib module pthread-spin for portability");
1825 # endif
1826 #endif
1827 
1828 
1829 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
1830 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
1831 #endif
1832