1 /* Implement the most essential subset of POSIX 1003.1-2008 pthread.h.
3 Copyright (C) 2009-2024 Free Software Foundation, Inc.
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18 /* Written by Paul Eggert, Glen Lenker, and Bruno Haible. */
21 @PRAGMA_SYSTEM_HEADER@
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. */
33 #@INCLUDE_NEXT@ @NEXT_PTHREAD_H@
36 /* Normal invocation convention. */
38 #ifndef _@GUARD_PREFIX@_PTHREAD_H_
42 # define _GL_ALREADY_INCLUDING_PTHREAD_H
44 /* The include_next requires a split double-inclusion guard. */
45 # @INCLUDE_NEXT@ @NEXT_PTHREAD_H@
47 # undef _GL_ALREADY_INCLUDING_PTHREAD_H
51 #ifndef _@GUARD_PREFIX@_PTHREAD_H_
52 #define _@GUARD_PREFIX@_PTHREAD_H_
54 /* This file uses _Noreturn, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK,
56 #if !_GL_CONFIG_H_INCLUDED
57 #error "Please include config.h first."
60 #define __need_system_stdlib_h
62 #undef __need_system_stdlib_h
65 /* The pthreads-win32 <pthread.h> defines a couple of broken macros. */
75 #include <sys/types.h>
78 /* The __attribute__ feature is available in gcc versions 2.5 and later.
79 The attribute __pure__ was added in gcc 2.96. */
80 #ifndef _GL_ATTRIBUTE_PURE
81 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__
82 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
84 # define _GL_ATTRIBUTE_PURE /* empty */
88 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
90 /* The definition of _Noreturn is copied here. */
92 /* The definition of _GL_ARG_NONNULL is copied here. */
94 /* The definition of _GL_WARN_ON_USE is copied here. */
96 /* =========== Thread types and macros =========== */
98 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
99 # if @GNULIB_PTHREAD_THREAD@
100 # include "windows-thread.h"
101 # if @HAVE_PTHREAD_T@
102 # define pthread_t rpl_pthread_t
103 # define pthread_attr_t rpl_pthread_attr_t
105 # if !GNULIB_defined_pthread_thread_types
106 typedef glwthread_thread_t pthread_t
;
107 typedef unsigned int pthread_attr_t
;
108 # define GNULIB_defined_pthread_thread_types 1
111 # if @HAVE_PTHREAD_T@
112 # define pthread_t rpl_pthread_t
113 # define pthread_attr_t rpl_pthread_attr_t
115 # if !GNULIB_defined_pthread_thread_types
116 typedef int pthread_t
;
117 typedef unsigned int pthread_attr_t
;
118 # define GNULIB_defined_pthread_thread_types 1
121 # undef PTHREAD_CREATE_JOINABLE
122 # undef PTHREAD_CREATE_DETACHED
123 # define PTHREAD_CREATE_JOINABLE 0
124 # define PTHREAD_CREATE_DETACHED 1
126 # if !@HAVE_PTHREAD_T@
127 # if !GNULIB_defined_pthread_thread_types
128 typedef int pthread_t
;
129 typedef unsigned int pthread_attr_t
;
130 # define GNULIB_defined_pthread_thread_types 1
133 # if !@HAVE_PTHREAD_CREATE_DETACHED@
134 # define PTHREAD_CREATE_JOINABLE 0
135 # define PTHREAD_CREATE_DETACHED 1
139 /* =========== Once-only control (initialization) types and macros ========== */
141 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
142 # if @GNULIB_PTHREAD_ONCE@
143 # include "windows-once.h"
144 # if @HAVE_PTHREAD_T@
145 # define pthread_once_t rpl_pthread_once_t
147 # if !GNULIB_defined_pthread_once_types
148 typedef glwthread_once_t pthread_once_t
;
149 # define GNULIB_defined_pthread_once_types 1
151 # undef PTHREAD_ONCE_INIT
152 # define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT
154 # if @HAVE_PTHREAD_T@
155 # define pthread_once_t rpl_pthread_once_t
157 # if !GNULIB_defined_pthread_once_types
158 typedef int pthread_once_t
;
159 # define GNULIB_defined_pthread_once_types 1
161 # undef PTHREAD_ONCE_INIT
162 # define PTHREAD_ONCE_INIT { 0 }
165 # if !@HAVE_PTHREAD_T@
166 # if !GNULIB_defined_pthread_once_types
167 typedef int pthread_once_t
;
168 # define GNULIB_defined_pthread_once_types 1
170 # undef PTHREAD_ONCE_INIT
171 # define PTHREAD_ONCE_INIT { 0 }
175 /* =========== Mutex types and macros =========== */
177 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
178 # if @GNULIB_PTHREAD_MUTEX@
179 # include "windows-timedmutex.h"
180 # include "windows-timedrecmutex.h"
181 # if @HAVE_PTHREAD_T@
182 # define pthread_mutex_t rpl_pthread_mutex_t
183 # define pthread_mutexattr_t rpl_pthread_mutexattr_t
185 # if !GNULIB_defined_pthread_mutex_types
191 glwthread_timedmutex_t u_timedmutex
;
192 glwthread_timedrecmutex_t u_timedrecmutex
;
197 typedef unsigned int pthread_mutexattr_t
;
198 # define GNULIB_defined_pthread_mutex_types 1
200 # undef PTHREAD_MUTEX_INITIALIZER
201 # define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } }
203 # if @HAVE_PTHREAD_T@
204 # define pthread_mutex_t rpl_pthread_mutex_t
205 # define pthread_mutexattr_t rpl_pthread_mutexattr_t
207 # if !GNULIB_defined_pthread_mutex_types
208 typedef int pthread_mutex_t
;
209 typedef unsigned int pthread_mutexattr_t
;
210 # define GNULIB_defined_pthread_mutex_types 1
212 # undef PTHREAD_MUTEX_INITIALIZER
213 # define PTHREAD_MUTEX_INITIALIZER { 0 }
215 # undef PTHREAD_MUTEX_DEFAULT
216 # undef PTHREAD_MUTEX_NORMAL
217 # undef PTHREAD_MUTEX_ERRORCHECK
218 # undef PTHREAD_MUTEX_RECURSIVE
219 # define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
220 # define PTHREAD_MUTEX_NORMAL 0
221 # define PTHREAD_MUTEX_ERRORCHECK 1
222 # define PTHREAD_MUTEX_RECURSIVE 2
223 # undef PTHREAD_MUTEX_STALLED
224 # undef PTHREAD_MUTEX_ROBUST
225 # define PTHREAD_MUTEX_STALLED 0
226 # define PTHREAD_MUTEX_ROBUST 1
228 # if !@HAVE_PTHREAD_T@
229 # if !GNULIB_defined_pthread_mutex_types
230 typedef int pthread_mutex_t
;
231 typedef unsigned int pthread_mutexattr_t
;
232 # define GNULIB_defined_pthread_mutex_types 1
234 # undef PTHREAD_MUTEX_INITIALIZER
235 # define PTHREAD_MUTEX_INITIALIZER { 0 }
237 # if !@HAVE_PTHREAD_MUTEX_RECURSIVE@
238 # define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
239 # define PTHREAD_MUTEX_NORMAL 0
240 # define PTHREAD_MUTEX_ERRORCHECK 1
241 # define PTHREAD_MUTEX_RECURSIVE 2
243 # if !@HAVE_PTHREAD_MUTEX_ROBUST@
244 # define PTHREAD_MUTEX_STALLED 0
245 # define PTHREAD_MUTEX_ROBUST 1
249 /* =========== Read-write lock types and macros =========== */
251 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
252 # if @GNULIB_PTHREAD_RWLOCK@
253 # include "windows-timedrwlock.h"
254 # if @HAVE_PTHREAD_T@
255 # define pthread_rwlock_t rpl_pthread_rwlock_t
256 # define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
258 # if !GNULIB_defined_pthread_rwlock_types
259 typedef glwthread_timedrwlock_t pthread_rwlock_t
;
260 typedef unsigned int pthread_rwlockattr_t
;
261 # define GNULIB_defined_pthread_rwlock_types 1
263 # undef PTHREAD_RWLOCK_INITIALIZER
264 # define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT
266 # if @HAVE_PTHREAD_T@
267 # define pthread_rwlock_t rpl_pthread_rwlock_t
268 # define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
270 # if !GNULIB_defined_pthread_rwlock_types
271 typedef int pthread_rwlock_t
;
272 typedef unsigned int pthread_rwlockattr_t
;
273 # define GNULIB_defined_pthread_rwlock_types 1
275 # undef PTHREAD_RWLOCK_INITIALIZER
276 # define PTHREAD_RWLOCK_INITIALIZER { 0 }
278 #elif @GNULIB_PTHREAD_RWLOCK@ && @REPLACE_PTHREAD_RWLOCK_INIT@ /* i.e. PTHREAD_RWLOCK_UNIMPLEMENTED */
279 # if @HAVE_PTHREAD_T@
280 # define pthread_rwlock_t rpl_pthread_rwlock_t
281 # define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
283 # if !GNULIB_defined_pthread_rwlock_types
286 pthread_mutex_t lock
; /* protects the remaining fields */
287 pthread_cond_t waiting_readers
; /* waiting readers */
288 pthread_cond_t waiting_writers
; /* waiting writers */
289 unsigned int waiting_writers_count
; /* number of waiting writers */
290 int runcount
; /* number of readers running, or -1 when a writer runs */
293 typedef unsigned int pthread_rwlockattr_t
;
294 # define GNULIB_defined_pthread_rwlock_types 1
296 # undef PTHREAD_RWLOCK_INITIALIZER
297 # define PTHREAD_RWLOCK_INITIALIZER \
298 { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
300 # if @HAVE_PTHREAD_T@
301 # if !defined PTHREAD_RWLOCK_INITIALIZER && defined PTHREAD_RWLOCK_INITIALIZER_NP /* z/OS */
302 # define PTHREAD_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER_NP
305 # if !GNULIB_defined_pthread_rwlock_types
306 typedef int pthread_rwlock_t
;
307 typedef unsigned int pthread_rwlockattr_t
;
308 # define GNULIB_defined_pthread_rwlock_types 1
310 # undef PTHREAD_RWLOCK_INITIALIZER
311 # define PTHREAD_RWLOCK_INITIALIZER { 0 }
315 /* =========== Condition variable types and macros =========== */
317 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
318 # if @GNULIB_PTHREAD_COND@
319 # include "windows-cond.h"
320 # if @HAVE_PTHREAD_T@
321 # define pthread_cond_t rpl_pthread_cond_t
322 # define pthread_condattr_t rpl_pthread_condattr_t
324 # if !GNULIB_defined_pthread_cond_types
325 typedef glwthread_cond_t pthread_cond_t
;
326 typedef unsigned int pthread_condattr_t
;
327 # define GNULIB_defined_pthread_cond_types 1
329 # undef PTHREAD_COND_INITIALIZER
330 # define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT
332 # if @HAVE_PTHREAD_T@
333 # define pthread_cond_t rpl_pthread_cond_t
334 # define pthread_condattr_t rpl_pthread_condattr_t
336 # if !GNULIB_defined_pthread_cond_types
337 typedef int pthread_cond_t
;
338 typedef unsigned int pthread_condattr_t
;
339 # define GNULIB_defined_pthread_cond_types 1
341 # undef PTHREAD_COND_INITIALIZER
342 # define PTHREAD_COND_INITIALIZER { 0 }
345 # if !@HAVE_PTHREAD_T@
346 # if !GNULIB_defined_pthread_cond_types
347 typedef int pthread_cond_t
;
348 typedef unsigned int pthread_condattr_t
;
349 # define GNULIB_defined_pthread_cond_types 1
351 # undef PTHREAD_COND_INITIALIZER
352 # define PTHREAD_COND_INITIALIZER { 0 }
356 /* =========== Thread-specific storage types and macros =========== */
358 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
359 # if @GNULIB_PTHREAD_TSS@
360 # include "windows-tls.h"
361 # if @HAVE_PTHREAD_T@
362 # define pthread_key_t rpl_pthread_key_t
364 # if !GNULIB_defined_pthread_tss_types
365 typedef glwthread_tls_key_t pthread_key_t
;
366 # define GNULIB_defined_pthread_tss_types 1
368 # undef PTHREAD_DESTRUCTOR_ITERATIONS
369 # define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS
371 # if @HAVE_PTHREAD_T@
372 # define pthread_key_t rpl_pthread_key_t
374 # if !GNULIB_defined_pthread_tss_types
375 typedef void ** pthread_key_t
;
376 # define GNULIB_defined_pthread_tss_types 1
378 # undef PTHREAD_DESTRUCTOR_ITERATIONS
379 # define PTHREAD_DESTRUCTOR_ITERATIONS 0
382 # if !@HAVE_PTHREAD_T@
383 # if !GNULIB_defined_pthread_tss_types
384 typedef void ** pthread_key_t
;
385 # define GNULIB_defined_pthread_tss_types 1
387 # undef PTHREAD_DESTRUCTOR_ITERATIONS
388 # define PTHREAD_DESTRUCTOR_ITERATIONS 0
392 /* =========== Spinlock types and macros =========== */
394 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
395 # if @GNULIB_PTHREAD_SPIN@
396 # include "windows-spin.h"
397 # if @HAVE_PTHREAD_T@
398 # define pthread_spinlock_t rpl_pthread_spinlock_t
400 # if !GNULIB_defined_pthread_spin_types
401 typedef glwthread_spinlock_t pthread_spinlock_t
;
402 # define GNULIB_defined_pthread_spin_types 1
405 # if @HAVE_PTHREAD_T@
406 # define pthread_spinlock_t rpl_pthread_spinlock_t
408 # if !GNULIB_defined_pthread_spin_types
409 typedef pthread_mutex_t pthread_spinlock_t
;
410 # define GNULIB_defined_pthread_spin_types 1
413 # undef PTHREAD_PROCESS_PRIVATE
414 # undef PTHREAD_PROCESS_SHARED
415 # define PTHREAD_PROCESS_PRIVATE 0
416 # define PTHREAD_PROCESS_SHARED 1
418 # if @HAVE_PTHREAD_SPINLOCK_T@
419 /* <pthread.h> exists and defines pthread_spinlock_t. */
420 # if !@HAVE_PTHREAD_SPIN_INIT@ || @REPLACE_PTHREAD_SPIN_INIT@
421 /* If the 'pthread-spin' module is in use, it defines all the pthread_spin*
422 functions. Prepare for it by overriding pthread_spinlock_t if that might
424 # if !(((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \
425 || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) \
426 || (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \
427 && !defined __ANDROID__) \
428 || __clang_major__ >= 3)) \
429 && !defined __ibmxl__)
430 /* We can't use GCC built-ins. Approximate spinlocks with mutexes. */
431 # if !GNULIB_defined_pthread_spin_types
432 # define pthread_spinlock_t pthread_mutex_t
433 # define GNULIB_defined_pthread_spin_types 1
438 /* Approximate spinlocks with mutexes. */
439 # if !GNULIB_defined_pthread_spin_types
440 typedef pthread_mutex_t pthread_spinlock_t
;
441 # define GNULIB_defined_pthread_spin_types 1
444 # if !@HAVE_PTHREAD_PROCESS_SHARED@
445 # define PTHREAD_PROCESS_PRIVATE 0
446 # define PTHREAD_PROCESS_SHARED 1
450 /* =========== Other types and macros =========== */
452 #if !@HAVE_PTHREAD_T@
453 # if !GNULIB_defined_other_pthread_types
454 typedef int pthread_barrier_t
;
455 typedef unsigned int pthread_barrierattr_t
;
456 # define GNULIB_defined_other_pthread_types 1
460 #if !defined PTHREAD_CANCELED
462 # define PTHREAD_BARRIER_SERIAL_THREAD (-1)
464 # define PTHREAD_CANCEL_DEFERRED 0
465 # define PTHREAD_CANCEL_ASYNCHRONOUS 1
467 # define PTHREAD_CANCEL_ENABLE 0
468 # define PTHREAD_CANCEL_DISABLE 1
470 # define PTHREAD_CANCELED ((void *) -1)
472 # define PTHREAD_INHERIT_SCHED 0
473 # define PTHREAD_EXPLICIT_SCHED 1
475 # define PTHREAD_PRIO_NONE 0
476 # define PTHREAD_PRIO_INHERIT 1
477 # define PTHREAD_PRIO_PROTECT 2
479 # define PTHREAD_SCOPE_SYSTEM 0
480 # define PTHREAD_SCOPE_PROCESS 1
484 /* =========== Thread functions =========== */
486 #if @GNULIB_PTHREAD_THREAD@
487 /* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way.
489 # if @REPLACE_PTHREAD_CREATE@
490 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
491 # undef pthread_create
492 # define pthread_create rpl_pthread_create
494 _GL_FUNCDECL_RPL (pthread_create
, int,
495 (pthread_t
*restrict threadp
,
496 const pthread_attr_t
*restrict attr
,
497 void * (*mainfunc
) (void *), void *restrict arg
)
498 _GL_ARG_NONNULL ((1, 3)));
499 _GL_CXXALIAS_RPL (pthread_create
, int,
500 (pthread_t
*restrict threadp
,
501 const pthread_attr_t
*restrict attr
,
502 void * (*mainfunc
) (void *), void *restrict arg
));
504 # if !@HAVE_PTHREAD_CREATE@
505 _GL_FUNCDECL_SYS (pthread_create
, int,
506 (pthread_t
*restrict threadp
,
507 const pthread_attr_t
*restrict attr
,
508 void * (*mainfunc
) (void *), void *restrict arg
)
509 _GL_ARG_NONNULL ((1, 3)));
511 _GL_CXXALIAS_SYS_CAST (pthread_create
, int,
512 (pthread_t
*restrict threadp
,
513 const pthread_attr_t
*restrict attr
,
514 void * (*mainfunc
) (void *), void *restrict arg
));
517 _GL_CXXALIASWARN (pthread_create
);
519 #elif defined GNULIB_POSIXCHECK
520 # undef pthread_create
521 # if HAVE_RAW_DECL_PTHREAD_CREATE
522 _GL_WARN_ON_USE (pthread_create
, "pthread_create is not portable - "
523 "use gnulib module pthread-thread for portability");
527 #if @GNULIB_PTHREAD_THREAD@
528 # if @REPLACE_PTHREAD_ATTR_INIT@
529 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
530 # undef pthread_attr_init
531 # define pthread_attr_init rpl_pthread_attr_init
533 _GL_FUNCDECL_RPL (pthread_attr_init
, int, (pthread_attr_t
*attr
)
534 _GL_ARG_NONNULL ((1)));
535 _GL_CXXALIAS_RPL (pthread_attr_init
, int, (pthread_attr_t
*attr
));
537 # if !@HAVE_PTHREAD_ATTR_INIT@
538 _GL_FUNCDECL_SYS (pthread_attr_init
, int, (pthread_attr_t
*attr
)
539 _GL_ARG_NONNULL ((1)));
541 _GL_CXXALIAS_SYS (pthread_attr_init
, int, (pthread_attr_t
*attr
));
544 _GL_CXXALIASWARN (pthread_attr_init
);
546 #elif defined GNULIB_POSIXCHECK
547 # undef pthread_attr_init
548 # if HAVE_RAW_DECL_PTHREAD_ATTR_INIT
549 _GL_WARN_ON_USE (pthread_attr_init
, "pthread_attr_init is not portable - "
550 "use gnulib module pthread-thread for portability");
554 #if @GNULIB_PTHREAD_THREAD@
555 # if @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@
556 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
557 # undef pthread_attr_getdetachstate
558 # define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
560 _GL_FUNCDECL_RPL (pthread_attr_getdetachstate
, int,
561 (const pthread_attr_t
*attr
, int *detachstatep
)
562 _GL_ARG_NONNULL ((1, 2)));
563 _GL_CXXALIAS_RPL (pthread_attr_getdetachstate
, int,
564 (const pthread_attr_t
*attr
, int *detachstatep
));
566 # if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@
567 _GL_FUNCDECL_SYS (pthread_attr_getdetachstate
, int,
568 (const pthread_attr_t
*attr
, int *detachstatep
)
569 _GL_ARG_NONNULL ((1, 2)));
571 _GL_CXXALIAS_SYS (pthread_attr_getdetachstate
, int,
572 (const pthread_attr_t
*attr
, int *detachstatep
));
575 _GL_CXXALIASWARN (pthread_attr_getdetachstate
);
577 #elif defined GNULIB_POSIXCHECK
578 # undef pthread_attr_getdetachstate
579 # if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE
580 _GL_WARN_ON_USE (pthread_attr_getdetachstate
, "pthread_attr_getdetachstate is not portable - "
581 "use gnulib module pthread-thread for portability");
585 #if @GNULIB_PTHREAD_THREAD@
586 # if @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@
587 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
588 # undef pthread_attr_setdetachstate
589 # define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
591 _GL_FUNCDECL_RPL (pthread_attr_setdetachstate
, int,
592 (pthread_attr_t
*attr
, int detachstate
)
593 _GL_ARG_NONNULL ((1)));
594 _GL_CXXALIAS_RPL (pthread_attr_setdetachstate
, int,
595 (pthread_attr_t
*attr
, int detachstate
));
597 # if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@
598 _GL_FUNCDECL_SYS (pthread_attr_setdetachstate
, int,
599 (pthread_attr_t
*attr
, int detachstate
)
600 _GL_ARG_NONNULL ((1)));
602 _GL_CXXALIAS_SYS (pthread_attr_setdetachstate
, int,
603 (pthread_attr_t
*attr
, int detachstate
));
606 _GL_CXXALIASWARN (pthread_attr_setdetachstate
);
608 #elif defined GNULIB_POSIXCHECK
609 # undef pthread_attr_setdetachstate
610 # if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE
611 _GL_WARN_ON_USE (pthread_attr_setdetachstate
, "pthread_attr_setdetachstate is not portable - "
612 "use gnulib module pthread-thread for portability");
616 #if @GNULIB_PTHREAD_THREAD@
617 # if @REPLACE_PTHREAD_ATTR_DESTROY@
618 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
619 # undef pthread_attr_destroy
620 # define pthread_attr_destroy rpl_pthread_attr_destroy
622 _GL_FUNCDECL_RPL (pthread_attr_destroy
, int, (pthread_attr_t
*attr
)
623 _GL_ARG_NONNULL ((1)));
624 _GL_CXXALIAS_RPL (pthread_attr_destroy
, int, (pthread_attr_t
*attr
));
626 # if !@HAVE_PTHREAD_ATTR_DESTROY@
627 _GL_FUNCDECL_SYS (pthread_attr_destroy
, int, (pthread_attr_t
*attr
)
628 _GL_ARG_NONNULL ((1)));
630 _GL_CXXALIAS_SYS (pthread_attr_destroy
, int, (pthread_attr_t
*attr
));
633 _GL_CXXALIASWARN (pthread_attr_destroy
);
635 #elif defined GNULIB_POSIXCHECK
636 # undef pthread_attr_destroy
637 # if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY
638 _GL_WARN_ON_USE (pthread_attr_destroy
, "pthread_attr_destroy is not portable - "
639 "use gnulib module pthread-thread for portability");
643 #if @GNULIB_PTHREAD_THREAD@
644 # if @REPLACE_PTHREAD_SELF@
645 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
647 # define pthread_self rpl_pthread_self
649 _GL_FUNCDECL_RPL (pthread_self
, pthread_t
, (void) _GL_ATTRIBUTE_PURE
);
650 _GL_CXXALIAS_RPL (pthread_self
, pthread_t
, (void));
652 # if !@HAVE_PTHREAD_SELF@
653 _GL_FUNCDECL_SYS (pthread_self
, pthread_t
, (void) _GL_ATTRIBUTE_PURE
);
655 _GL_CXXALIAS_SYS (pthread_self
, pthread_t
, (void));
658 _GL_CXXALIASWARN (pthread_self
);
660 #elif defined GNULIB_POSIXCHECK
662 # if HAVE_RAW_DECL_PTHREAD_SELF
663 _GL_WARN_ON_USE (pthread_self
, "pthread_self is not portable - "
664 "use gnulib module pthread-thread for portability");
668 #if @GNULIB_PTHREAD_THREAD@
669 # if @REPLACE_PTHREAD_EQUAL@
670 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
671 # undef pthread_equal
672 # define pthread_equal rpl_pthread_equal
674 _GL_FUNCDECL_RPL (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
675 _GL_CXXALIAS_RPL (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
677 # if !@HAVE_PTHREAD_EQUAL@
678 _GL_FUNCDECL_SYS (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
680 _GL_CXXALIAS_SYS (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
683 _GL_CXXALIASWARN (pthread_equal
);
685 #elif defined GNULIB_POSIXCHECK
686 # undef pthread_equal
687 # if HAVE_RAW_DECL_PTHREAD_EQUAL
688 _GL_WARN_ON_USE (pthread_equal
, "pthread_equal is not portable - "
689 "use gnulib module pthread-thread for portability");
693 #if @GNULIB_PTHREAD_THREAD@
694 # if @REPLACE_PTHREAD_DETACH@
695 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
696 # undef pthread_detach
697 # define pthread_detach rpl_pthread_detach
699 _GL_FUNCDECL_RPL (pthread_detach
, int, (pthread_t thread
));
700 _GL_CXXALIAS_RPL (pthread_detach
, int, (pthread_t thread
));
702 # if !@HAVE_PTHREAD_DETACH@
703 _GL_FUNCDECL_SYS (pthread_detach
, int, (pthread_t thread
));
705 _GL_CXXALIAS_SYS (pthread_detach
, int, (pthread_t thread
));
708 _GL_CXXALIASWARN (pthread_detach
);
710 #elif defined GNULIB_POSIXCHECK
711 # undef pthread_detach
712 # if HAVE_RAW_DECL_PTHREAD_DETACH
713 _GL_WARN_ON_USE (pthread_detach
, "pthread_detach is not portable - "
714 "use gnulib module pthread-thread for portability");
718 #if @GNULIB_PTHREAD_THREAD@
719 # if @REPLACE_PTHREAD_JOIN@
720 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
722 # define pthread_join rpl_pthread_join
724 _GL_FUNCDECL_RPL (pthread_join
, int, (pthread_t thread
, void **valuep
));
725 _GL_CXXALIAS_RPL (pthread_join
, int, (pthread_t thread
, void **valuep
));
727 # if !@HAVE_PTHREAD_JOIN@
728 _GL_FUNCDECL_SYS (pthread_join
, int, (pthread_t thread
, void **valuep
));
730 _GL_CXXALIAS_SYS (pthread_join
, int, (pthread_t thread
, void **valuep
));
733 _GL_CXXALIASWARN (pthread_join
);
735 #elif defined GNULIB_POSIXCHECK
737 # if HAVE_RAW_DECL_PTHREAD_JOIN
738 _GL_WARN_ON_USE (pthread_join
, "pthread_join is not portable - "
739 "use gnulib module pthread-thread for portability");
743 #if @GNULIB_PTHREAD_THREAD@
744 # if @REPLACE_PTHREAD_EXIT@
745 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
747 # define pthread_exit rpl_pthread_exit
749 _GL_FUNCDECL_RPL (pthread_exit
, _Noreturn
void, (void *value
));
750 _GL_CXXALIAS_RPL (pthread_exit
, void, (void *value
));
752 # if !@HAVE_PTHREAD_EXIT@
753 _GL_FUNCDECL_SYS (pthread_exit
, _Noreturn
void, (void *value
));
755 /* Need to cast because of AIX with xlclang++. */
756 _GL_CXXALIAS_SYS_CAST (pthread_exit
, void, (void *value
));
759 _GL_CXXALIASWARN (pthread_exit
);
761 #elif defined GNULIB_POSIXCHECK
763 # if HAVE_RAW_DECL_PTHREAD_EXIT
764 _GL_WARN_ON_USE (pthread_exit
, "pthread_exit is not portable - "
765 "use gnulib module pthread-thread for portability");
769 /* =========== Once-only control (initialization) functions =========== */
771 #if @GNULIB_PTHREAD_ONCE@
772 # if @REPLACE_PTHREAD_ONCE@
773 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
775 # define pthread_once rpl_pthread_once
777 _GL_FUNCDECL_RPL (pthread_once
, int,
778 (pthread_once_t
*once_control
, void (*initfunction
) (void))
779 _GL_ARG_NONNULL ((1, 2)));
780 _GL_CXXALIAS_RPL (pthread_once
, int,
781 (pthread_once_t
*once_control
, void (*initfunction
) (void)));
783 # if !@HAVE_PTHREAD_ONCE@
784 _GL_FUNCDECL_SYS (pthread_once
, int,
785 (pthread_once_t
*once_control
, void (*initfunction
) (void))
786 _GL_ARG_NONNULL ((1, 2)));
788 _GL_CXXALIAS_SYS_CAST (pthread_once
, int,
789 (pthread_once_t
*once_control
,
790 void (*initfunction
) (void)));
793 _GL_CXXALIASWARN (pthread_once
);
795 #elif defined GNULIB_POSIXCHECK
797 # if HAVE_RAW_DECL_PTHREAD_ONCE
798 _GL_WARN_ON_USE (pthread_once
, "pthread_once is not portable - "
799 "use gnulib module pthread-once for portability");
803 /* =========== Mutex functions =========== */
805 #if @GNULIB_PTHREAD_MUTEX@
806 # if @REPLACE_PTHREAD_MUTEX_INIT@
807 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
808 # undef pthread_mutex_init
809 # define pthread_mutex_init rpl_pthread_mutex_init
811 _GL_FUNCDECL_RPL (pthread_mutex_init
, int,
812 (pthread_mutex_t
*restrict mutex
,
813 const pthread_mutexattr_t
*restrict attr
)
814 _GL_ARG_NONNULL ((1)));
815 _GL_CXXALIAS_RPL (pthread_mutex_init
, int,
816 (pthread_mutex_t
*restrict mutex
,
817 const pthread_mutexattr_t
*restrict attr
));
819 # if !@HAVE_PTHREAD_MUTEX_INIT@
820 _GL_FUNCDECL_SYS (pthread_mutex_init
, int,
821 (pthread_mutex_t
*restrict mutex
,
822 const pthread_mutexattr_t
*restrict attr
)
823 _GL_ARG_NONNULL ((1)));
825 _GL_CXXALIAS_SYS (pthread_mutex_init
, int,
826 (pthread_mutex_t
*restrict mutex
,
827 const pthread_mutexattr_t
*restrict attr
));
830 _GL_CXXALIASWARN (pthread_mutex_init
);
832 #elif defined GNULIB_POSIXCHECK
833 # undef pthread_mutex_init
834 # if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT
835 _GL_WARN_ON_USE (pthread_mutex_init
, "pthread_mutex_init is not portable - "
836 "use gnulib module pthread-mutex for portability");
840 #if @GNULIB_PTHREAD_MUTEX@
841 # if @REPLACE_PTHREAD_MUTEXATTR_INIT@
842 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
843 # undef pthread_mutexattr_init
844 # define pthread_mutexattr_init rpl_pthread_mutexattr_init
846 _GL_FUNCDECL_RPL (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
)
847 _GL_ARG_NONNULL ((1)));
848 _GL_CXXALIAS_RPL (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
));
850 # if !@HAVE_PTHREAD_MUTEXATTR_INIT@
851 _GL_FUNCDECL_SYS (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
)
852 _GL_ARG_NONNULL ((1)));
854 _GL_CXXALIAS_SYS (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
));
857 _GL_CXXALIASWARN (pthread_mutexattr_init
);
859 #elif defined GNULIB_POSIXCHECK
860 # undef pthread_mutexattr_init
861 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT
862 _GL_WARN_ON_USE (pthread_mutexattr_init
, "pthread_mutexattr_init is not portable - "
863 "use gnulib module pthread-mutex for portability");
867 #if @GNULIB_PTHREAD_MUTEX@
868 # if @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@
869 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
870 # undef pthread_mutexattr_gettype
871 # define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype
873 _GL_FUNCDECL_RPL (pthread_mutexattr_gettype
, int,
874 (const pthread_mutexattr_t
*restrict attr
,
876 _GL_ARG_NONNULL ((1, 2)));
877 _GL_CXXALIAS_RPL (pthread_mutexattr_gettype
, int,
878 (const pthread_mutexattr_t
*restrict attr
,
879 int *restrict typep
));
881 # if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@
882 _GL_FUNCDECL_SYS (pthread_mutexattr_gettype
, int,
883 (const pthread_mutexattr_t
*restrict attr
,
885 _GL_ARG_NONNULL ((1, 2)));
887 /* Need to cast, because on FreeBSD the first parameter is
888 pthread_mutexattr_t *attr. */
889 _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype
, int,
890 (const pthread_mutexattr_t
*restrict attr
,
891 int *restrict typep
));
894 _GL_CXXALIASWARN (pthread_mutexattr_gettype
);
896 #elif defined GNULIB_POSIXCHECK
897 # undef pthread_mutexattr_gettype
898 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE
899 _GL_WARN_ON_USE (pthread_mutexattr_gettype
, "pthread_mutexattr_gettype is not portable - "
900 "use gnulib module pthread-mutex for portability");
904 #if @GNULIB_PTHREAD_MUTEX@
905 # if @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@
906 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
907 # undef pthread_mutexattr_settype
908 # define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
910 _GL_FUNCDECL_RPL (pthread_mutexattr_settype
, int,
911 (pthread_mutexattr_t
*attr
, int type
) _GL_ARG_NONNULL ((1)));
912 _GL_CXXALIAS_RPL (pthread_mutexattr_settype
, int,
913 (pthread_mutexattr_t
*attr
, int type
));
915 # if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@
916 _GL_FUNCDECL_SYS (pthread_mutexattr_settype
, int,
917 (pthread_mutexattr_t
*attr
, int type
) _GL_ARG_NONNULL ((1)));
919 _GL_CXXALIAS_SYS (pthread_mutexattr_settype
, int,
920 (pthread_mutexattr_t
*attr
, int type
));
923 _GL_CXXALIASWARN (pthread_mutexattr_settype
);
925 #elif defined GNULIB_POSIXCHECK
926 # undef pthread_mutexattr_settype
927 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE
928 _GL_WARN_ON_USE (pthread_mutexattr_settype
, "pthread_mutexattr_settype is not portable - "
929 "use gnulib module pthread-mutex for portability");
933 #if @GNULIB_PTHREAD_MUTEX@
934 # if @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@
935 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
936 # undef pthread_mutexattr_getrobust
937 # define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust
939 _GL_FUNCDECL_RPL (pthread_mutexattr_getrobust
, int,
940 (const pthread_mutexattr_t
*restrict attr
,
941 int *restrict robustp
)
942 _GL_ARG_NONNULL ((1, 2)));
943 _GL_CXXALIAS_RPL (pthread_mutexattr_getrobust
, int,
944 (const pthread_mutexattr_t
*restrict attr
,
945 int *restrict robustp
));
947 # if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@
948 _GL_FUNCDECL_SYS (pthread_mutexattr_getrobust
, int,
949 (const pthread_mutexattr_t
*restrict attr
,
950 int *restrict robustp
)
951 _GL_ARG_NONNULL ((1, 2)));
953 /* Need to cast, because on FreeBSD the first parameter is
954 pthread_mutexattr_t *attr. */
955 _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust
, int,
956 (const pthread_mutexattr_t
*restrict attr
,
957 int *restrict robustp
));
960 _GL_CXXALIASWARN (pthread_mutexattr_getrobust
);
962 #elif defined GNULIB_POSIXCHECK
963 # undef pthread_mutexattr_getrobust
964 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
965 _GL_WARN_ON_USE (pthread_mutexattr_getrobust
, "pthread_mutexattr_getrobust is not portable - "
966 "use gnulib module pthread-mutex for portability");
970 #if @GNULIB_PTHREAD_MUTEX@
971 # if @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@
972 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
973 # undef pthread_mutexattr_setrobust
974 # define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
976 _GL_FUNCDECL_RPL (pthread_mutexattr_setrobust
, int,
977 (pthread_mutexattr_t
*attr
, int robust
)
978 _GL_ARG_NONNULL ((1)));
979 _GL_CXXALIAS_RPL (pthread_mutexattr_setrobust
, int,
980 (pthread_mutexattr_t
*attr
, int robust
));
982 # if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@
983 _GL_FUNCDECL_SYS (pthread_mutexattr_setrobust
, int,
984 (pthread_mutexattr_t
*attr
, int robust
)
985 _GL_ARG_NONNULL ((1)));
987 _GL_CXXALIAS_SYS (pthread_mutexattr_setrobust
, int,
988 (pthread_mutexattr_t
*attr
, int robust
));
991 _GL_CXXALIASWARN (pthread_mutexattr_setrobust
);
993 #elif defined GNULIB_POSIXCHECK
994 # undef pthread_mutexattr_setrobust
995 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
996 _GL_WARN_ON_USE (pthread_mutexattr_setrobust
, "pthread_mutexattr_setrobust is not portable - "
997 "use gnulib module pthread-mutex for portability");
1001 #if @GNULIB_PTHREAD_MUTEX@
1002 # if @REPLACE_PTHREAD_MUTEXATTR_DESTROY@
1003 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1004 # undef pthread_mutexattr_destroy
1005 # define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
1007 _GL_FUNCDECL_RPL (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
)
1008 _GL_ARG_NONNULL ((1)));
1009 _GL_CXXALIAS_RPL (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
));
1011 # if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@
1012 _GL_FUNCDECL_SYS (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
)
1013 _GL_ARG_NONNULL ((1)));
1015 _GL_CXXALIAS_SYS (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
));
1018 _GL_CXXALIASWARN (pthread_mutexattr_destroy
);
1020 #elif defined GNULIB_POSIXCHECK
1021 # undef pthread_mutexattr_destroy
1022 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY
1023 _GL_WARN_ON_USE (pthread_mutexattr_destroy
, "pthread_mutexattr_destroy is not portable - "
1024 "use gnulib module pthread-mutex for portability");
1028 #if @GNULIB_PTHREAD_MUTEX@
1029 # if @REPLACE_PTHREAD_MUTEX_LOCK@
1030 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1031 # undef pthread_mutex_lock
1032 # define pthread_mutex_lock rpl_pthread_mutex_lock
1034 _GL_FUNCDECL_RPL (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
)
1035 _GL_ARG_NONNULL ((1)));
1036 _GL_CXXALIAS_RPL (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
));
1038 # if !@HAVE_PTHREAD_MUTEX_LOCK@
1039 _GL_FUNCDECL_SYS (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
)
1040 _GL_ARG_NONNULL ((1)));
1042 _GL_CXXALIAS_SYS (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
));
1045 _GL_CXXALIASWARN (pthread_mutex_lock
);
1047 #elif defined GNULIB_POSIXCHECK
1048 # undef pthread_mutex_lock
1049 # if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
1050 _GL_WARN_ON_USE (pthread_mutex_lock
, "pthread_mutex_lock is not portable - "
1051 "use gnulib module pthread-mutex for portability");
1055 #if @GNULIB_PTHREAD_MUTEX@
1056 # if @REPLACE_PTHREAD_MUTEX_TRYLOCK@
1057 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1058 # undef pthread_mutex_trylock
1059 # define pthread_mutex_trylock rpl_pthread_mutex_trylock
1061 _GL_FUNCDECL_RPL (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
)
1062 _GL_ARG_NONNULL ((1)));
1063 _GL_CXXALIAS_RPL (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
));
1065 # if !@HAVE_PTHREAD_MUTEX_TRYLOCK@
1066 _GL_FUNCDECL_SYS (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
)
1067 _GL_ARG_NONNULL ((1)));
1069 _GL_CXXALIAS_SYS (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
));
1072 _GL_CXXALIASWARN (pthread_mutex_trylock
);
1074 #elif defined GNULIB_POSIXCHECK
1075 # undef pthread_mutex_trylock
1076 # if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK
1077 _GL_WARN_ON_USE (pthread_mutex_trylock
, "pthread_mutex_trylock is not portable - "
1078 "use gnulib module pthread-mutex for portability");
1082 #if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
1083 # if @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@
1084 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1085 # undef pthread_mutex_timedlock
1086 # define pthread_mutex_timedlock rpl_pthread_mutex_timedlock
1088 _GL_FUNCDECL_RPL (pthread_mutex_timedlock
, int,
1089 (pthread_mutex_t
*restrict mutex
,
1090 const struct timespec
*restrict abstime
)
1091 _GL_ARG_NONNULL ((1, 2)));
1092 _GL_CXXALIAS_RPL (pthread_mutex_timedlock
, int,
1093 (pthread_mutex_t
*restrict mutex
,
1094 const struct timespec
*restrict abstime
));
1096 # if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@
1097 _GL_FUNCDECL_SYS (pthread_mutex_timedlock
, int,
1098 (pthread_mutex_t
*restrict mutex
,
1099 const struct timespec
*restrict abstime
)
1100 _GL_ARG_NONNULL ((1, 2)));
1102 _GL_CXXALIAS_SYS (pthread_mutex_timedlock
, int,
1103 (pthread_mutex_t
*restrict mutex
,
1104 const struct timespec
*restrict abstime
));
1107 _GL_CXXALIASWARN (pthread_mutex_timedlock
);
1109 #elif defined GNULIB_POSIXCHECK
1110 # undef pthread_mutex_timedlock
1111 # if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK
1112 _GL_WARN_ON_USE (pthread_mutex_timedlock
, "pthread_mutex_timedlock is not portable - "
1113 "use gnulib module pthread_mutex_timedlock for portability");
1117 #if @GNULIB_PTHREAD_MUTEX@
1118 # if @REPLACE_PTHREAD_MUTEX_UNLOCK@
1119 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1120 # undef pthread_mutex_unlock
1121 # define pthread_mutex_unlock rpl_pthread_mutex_unlock
1123 _GL_FUNCDECL_RPL (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
)
1124 _GL_ARG_NONNULL ((1)));
1125 _GL_CXXALIAS_RPL (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
));
1127 # if !@HAVE_PTHREAD_MUTEX_UNLOCK@
1128 _GL_FUNCDECL_SYS (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
)
1129 _GL_ARG_NONNULL ((1)));
1131 _GL_CXXALIAS_SYS (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
));
1134 _GL_CXXALIASWARN (pthread_mutex_unlock
);
1136 #elif defined GNULIB_POSIXCHECK
1137 # undef pthread_mutex_unlock
1138 # if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK
1139 _GL_WARN_ON_USE (pthread_mutex_unlock
, "pthread_mutex_unlock is not portable - "
1140 "use gnulib module pthread-mutex for portability");
1144 #if @GNULIB_PTHREAD_MUTEX@
1145 # if @REPLACE_PTHREAD_MUTEX_DESTROY@
1146 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1147 # undef pthread_mutex_destroy
1148 # define pthread_mutex_destroy rpl_pthread_mutex_destroy
1150 _GL_FUNCDECL_RPL (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
)
1151 _GL_ARG_NONNULL ((1)));
1152 _GL_CXXALIAS_RPL (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
));
1154 # if !@HAVE_PTHREAD_MUTEX_DESTROY@
1155 _GL_FUNCDECL_SYS (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
)
1156 _GL_ARG_NONNULL ((1)));
1158 _GL_CXXALIAS_SYS (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
));
1161 _GL_CXXALIASWARN (pthread_mutex_destroy
);
1163 #elif defined GNULIB_POSIXCHECK
1164 # undef pthread_mutex_destroy
1165 # if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY
1166 _GL_WARN_ON_USE (pthread_mutex_destroy
, "pthread_mutex_destroy is not portable - "
1167 "use gnulib module pthread-mutex for portability");
1171 /* =========== Read-write lock functions =========== */
1173 #if @GNULIB_PTHREAD_RWLOCK@
1174 # if @REPLACE_PTHREAD_RWLOCK_INIT@
1175 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1176 # undef pthread_rwlock_init
1177 # define pthread_rwlock_init rpl_pthread_rwlock_init
1179 _GL_FUNCDECL_RPL (pthread_rwlock_init
, int,
1180 (pthread_rwlock_t
*restrict lock
,
1181 const pthread_rwlockattr_t
*restrict attr
)
1182 _GL_ARG_NONNULL ((1)));
1183 _GL_CXXALIAS_RPL (pthread_rwlock_init
, int,
1184 (pthread_rwlock_t
*restrict lock
,
1185 const pthread_rwlockattr_t
*restrict attr
));
1187 # if !@HAVE_PTHREAD_RWLOCK_INIT@
1188 _GL_FUNCDECL_SYS (pthread_rwlock_init
, int,
1189 (pthread_rwlock_t
*restrict lock
,
1190 const pthread_rwlockattr_t
*restrict attr
)
1191 _GL_ARG_NONNULL ((1)));
1193 _GL_CXXALIAS_SYS (pthread_rwlock_init
, int,
1194 (pthread_rwlock_t
*restrict lock
,
1195 const pthread_rwlockattr_t
*restrict attr
));
1198 _GL_CXXALIASWARN (pthread_rwlock_init
);
1200 #elif defined GNULIB_POSIXCHECK
1201 # undef pthread_rwlock_init
1202 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT
1203 _GL_WARN_ON_USE (pthread_rwlock_init
, "pthread_rwlock_init is not portable - "
1204 "use gnulib module pthread-rwlock for portability");
1208 #if @GNULIB_PTHREAD_RWLOCK@
1209 # if @REPLACE_PTHREAD_RWLOCKATTR_INIT@
1210 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1211 # undef pthread_rwlockattr_init
1212 # define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
1214 _GL_FUNCDECL_RPL (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
)
1215 _GL_ARG_NONNULL ((1)));
1216 _GL_CXXALIAS_RPL (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
));
1218 # if !@HAVE_PTHREAD_RWLOCKATTR_INIT@
1219 _GL_FUNCDECL_SYS (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
)
1220 _GL_ARG_NONNULL ((1)));
1222 _GL_CXXALIAS_SYS (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
));
1225 _GL_CXXALIASWARN (pthread_rwlockattr_init
);
1227 #elif defined GNULIB_POSIXCHECK
1228 # undef pthread_rwlockattr_init
1229 # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT
1230 _GL_WARN_ON_USE (pthread_rwlockattr_init
, "pthread_rwlockattr_init is not portable - "
1231 "use gnulib module pthread-rwlock for portability");
1235 #if @GNULIB_PTHREAD_RWLOCK@
1236 # if @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@
1237 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1238 # undef pthread_rwlockattr_destroy
1239 # define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
1241 _GL_FUNCDECL_RPL (pthread_rwlockattr_destroy
, int,
1242 (pthread_rwlockattr_t
*attr
) _GL_ARG_NONNULL ((1)));
1243 _GL_CXXALIAS_RPL (pthread_rwlockattr_destroy
, int,
1244 (pthread_rwlockattr_t
*attr
));
1246 # if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@
1247 _GL_FUNCDECL_SYS (pthread_rwlockattr_destroy
, int,
1248 (pthread_rwlockattr_t
*attr
) _GL_ARG_NONNULL ((1)));
1250 _GL_CXXALIAS_SYS (pthread_rwlockattr_destroy
, int,
1251 (pthread_rwlockattr_t
*attr
));
1254 _GL_CXXALIASWARN (pthread_rwlockattr_destroy
);
1256 #elif defined GNULIB_POSIXCHECK
1257 # undef pthread_rwlockattr_destroy
1258 # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY
1259 _GL_WARN_ON_USE (pthread_rwlockattr_destroy
, "pthread_rwlockattr_destroy is not portable - "
1260 "use gnulib module pthread-rwlock for portability");
1264 #if @GNULIB_PTHREAD_RWLOCK@
1265 # if @REPLACE_PTHREAD_RWLOCK_RDLOCK@
1266 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1267 # undef pthread_rwlock_rdlock
1268 # define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
1270 _GL_FUNCDECL_RPL (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
)
1271 _GL_ARG_NONNULL ((1)));
1272 _GL_CXXALIAS_RPL (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
));
1274 # if !@HAVE_PTHREAD_RWLOCK_RDLOCK@
1275 _GL_FUNCDECL_SYS (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
)
1276 _GL_ARG_NONNULL ((1)));
1278 _GL_CXXALIAS_SYS (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
));
1281 _GL_CXXALIASWARN (pthread_rwlock_rdlock
);
1283 #elif defined GNULIB_POSIXCHECK
1284 # undef pthread_rwlock_rdlock
1285 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK
1286 _GL_WARN_ON_USE (pthread_rwlock_rdlock
, "pthread_rwlock_rdlock is not portable - "
1287 "use gnulib module pthread-rwlock for portability");
1291 #if @GNULIB_PTHREAD_RWLOCK@
1292 # if @REPLACE_PTHREAD_RWLOCK_WRLOCK@
1293 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1294 # undef pthread_rwlock_wrlock
1295 # define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
1297 _GL_FUNCDECL_RPL (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
)
1298 _GL_ARG_NONNULL ((1)));
1299 _GL_CXXALIAS_RPL (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
));
1301 # if !@HAVE_PTHREAD_RWLOCK_WRLOCK@
1302 _GL_FUNCDECL_SYS (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
)
1303 _GL_ARG_NONNULL ((1)));
1305 _GL_CXXALIAS_SYS (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
));
1308 _GL_CXXALIASWARN (pthread_rwlock_wrlock
);
1310 #elif defined GNULIB_POSIXCHECK
1311 # undef pthread_rwlock_wrlock
1312 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK
1313 _GL_WARN_ON_USE (pthread_rwlock_wrlock
, "pthread_rwlock_wrlock is not portable - "
1314 "use gnulib module pthread-rwlock for portability");
1318 #if @GNULIB_PTHREAD_RWLOCK@
1319 # if @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@
1320 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1321 # undef pthread_rwlock_tryrdlock
1322 # define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
1324 _GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
)
1325 _GL_ARG_NONNULL ((1)));
1326 _GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
));
1328 # if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
1329 _GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
)
1330 _GL_ARG_NONNULL ((1)));
1332 _GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
));
1335 _GL_CXXALIASWARN (pthread_rwlock_tryrdlock
);
1337 #elif defined GNULIB_POSIXCHECK
1338 # undef pthread_rwlock_tryrdlock
1339 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK
1340 _GL_WARN_ON_USE (pthread_rwlock_tryrdlock
, "pthread_rwlock_tryrdlock is not portable - "
1341 "use gnulib module pthread-rwlock for portability");
1345 #if @GNULIB_PTHREAD_RWLOCK@
1346 # if @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@
1347 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1348 # undef pthread_rwlock_trywrlock
1349 # define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
1351 _GL_FUNCDECL_RPL (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
)
1352 _GL_ARG_NONNULL ((1)));
1353 _GL_CXXALIAS_RPL (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
));
1355 # if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
1356 _GL_FUNCDECL_SYS (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
)
1357 _GL_ARG_NONNULL ((1)));
1359 _GL_CXXALIAS_SYS (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
));
1362 _GL_CXXALIASWARN (pthread_rwlock_trywrlock
);
1364 #elif defined GNULIB_POSIXCHECK
1365 # undef pthread_rwlock_trywrlock
1366 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK
1367 _GL_WARN_ON_USE (pthread_rwlock_trywrlock
, "pthread_rwlock_trywrlock is not portable - "
1368 "use gnulib module pthread-rwlock for portability");
1372 #if @GNULIB_PTHREAD_RWLOCK@
1373 # if @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1374 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1375 # undef pthread_rwlock_timedrdlock
1376 # define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock
1378 _GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock
, int,
1379 (pthread_rwlock_t
*restrict lock
,
1380 const struct timespec
*restrict abstime
)
1381 _GL_ARG_NONNULL ((1, 2)));
1382 _GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock
, int,
1383 (pthread_rwlock_t
*restrict lock
,
1384 const struct timespec
*restrict abstime
));
1386 # if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1387 _GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock
, int,
1388 (pthread_rwlock_t
*restrict lock
,
1389 const struct timespec
*restrict abstime
)
1390 _GL_ARG_NONNULL ((1, 2)));
1392 _GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock
, int,
1393 (pthread_rwlock_t
*restrict lock
,
1394 const struct timespec
*restrict abstime
));
1397 _GL_CXXALIASWARN (pthread_rwlock_timedrdlock
);
1399 #elif defined GNULIB_POSIXCHECK
1400 # undef pthread_rwlock_timedrdlock
1401 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK
1402 _GL_WARN_ON_USE (pthread_rwlock_timedrdlock
, "pthread_rwlock_timedrdlock is not portable - "
1403 "use gnulib module pthread-rwlock for portability");
1407 #if @GNULIB_PTHREAD_RWLOCK@
1408 # if @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1409 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1410 # undef pthread_rwlock_timedwrlock
1411 # define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock
1413 _GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock
, int,
1414 (pthread_rwlock_t
*restrict lock
,
1415 const struct timespec
*restrict abstime
)
1416 _GL_ARG_NONNULL ((1, 2)));
1417 _GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock
, int,
1418 (pthread_rwlock_t
*restrict lock
,
1419 const struct timespec
*restrict abstime
));
1421 # if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1422 _GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock
, int,
1423 (pthread_rwlock_t
*restrict lock
,
1424 const struct timespec
*restrict abstime
)
1425 _GL_ARG_NONNULL ((1, 2)));
1427 _GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock
, int,
1428 (pthread_rwlock_t
*restrict lock
,
1429 const struct timespec
*restrict abstime
));
1432 _GL_CXXALIASWARN (pthread_rwlock_timedwrlock
);
1434 #elif defined GNULIB_POSIXCHECK
1435 # undef pthread_rwlock_timedwrlock
1436 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK
1437 _GL_WARN_ON_USE (pthread_rwlock_timedwrlock
, "pthread_rwlock_timedwrlock is not portable - "
1438 "use gnulib module pthread-rwlock for portability");
1442 #if @GNULIB_PTHREAD_RWLOCK@
1443 # if @REPLACE_PTHREAD_RWLOCK_UNLOCK@
1444 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1445 # undef pthread_rwlock_unlock
1446 # define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
1448 _GL_FUNCDECL_RPL (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
)
1449 _GL_ARG_NONNULL ((1)));
1450 _GL_CXXALIAS_RPL (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
));
1452 # if !@HAVE_PTHREAD_RWLOCK_UNLOCK@
1453 _GL_FUNCDECL_SYS (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
)
1454 _GL_ARG_NONNULL ((1)));
1456 _GL_CXXALIAS_SYS (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
));
1459 _GL_CXXALIASWARN (pthread_rwlock_unlock
);
1461 #elif defined GNULIB_POSIXCHECK
1462 # undef pthread_rwlock_unlock
1463 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK
1464 _GL_WARN_ON_USE (pthread_rwlock_unlock
, "pthread_rwlock_unlock is not portable - "
1465 "use gnulib module pthread-rwlock for portability");
1469 #if @GNULIB_PTHREAD_RWLOCK@
1470 # if @REPLACE_PTHREAD_RWLOCK_DESTROY@
1471 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1472 # undef pthread_rwlock_destroy
1473 # define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
1475 _GL_FUNCDECL_RPL (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
)
1476 _GL_ARG_NONNULL ((1)));
1477 _GL_CXXALIAS_RPL (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
));
1479 # if !@HAVE_PTHREAD_RWLOCK_DESTROY@
1480 _GL_FUNCDECL_SYS (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
)
1481 _GL_ARG_NONNULL ((1)));
1483 _GL_CXXALIAS_SYS (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
));
1486 _GL_CXXALIASWARN (pthread_rwlock_destroy
);
1488 #elif defined GNULIB_POSIXCHECK
1489 # undef pthread_rwlock_destroy
1490 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY
1491 _GL_WARN_ON_USE (pthread_rwlock_destroy
, "pthread_rwlock_destroy is not portable - "
1492 "use gnulib module pthread-rwlock for portability");
1496 /* =========== Condition variable functions =========== */
1498 #if @GNULIB_PTHREAD_COND@
1499 # if @REPLACE_PTHREAD_COND_INIT@
1500 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1501 # undef pthread_cond_init
1502 # define pthread_cond_init rpl_pthread_cond_init
1504 _GL_FUNCDECL_RPL (pthread_cond_init
, int,
1505 (pthread_cond_t
*restrict cond
,
1506 const pthread_condattr_t
*restrict attr
)
1507 _GL_ARG_NONNULL ((1)));
1508 _GL_CXXALIAS_RPL (pthread_cond_init
, int,
1509 (pthread_cond_t
*restrict cond
,
1510 const pthread_condattr_t
*restrict attr
));
1512 # if !@HAVE_PTHREAD_COND_INIT@
1513 _GL_FUNCDECL_SYS (pthread_cond_init
, int,
1514 (pthread_cond_t
*restrict cond
,
1515 const pthread_condattr_t
*restrict attr
)
1516 _GL_ARG_NONNULL ((1)));
1518 _GL_CXXALIAS_SYS (pthread_cond_init
, int,
1519 (pthread_cond_t
*restrict cond
,
1520 const pthread_condattr_t
*restrict attr
));
1523 _GL_CXXALIASWARN (pthread_cond_init
);
1525 #elif defined GNULIB_POSIXCHECK
1526 # undef pthread_cond_init
1527 # if HAVE_RAW_DECL_PTHREAD_COND_INIT
1528 _GL_WARN_ON_USE (pthread_cond_init
, "pthread_cond_init is not portable - "
1529 "use gnulib module pthread-cond for portability");
1533 #if @GNULIB_PTHREAD_COND@
1534 # if @REPLACE_PTHREAD_CONDATTR_INIT@
1535 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1536 # undef pthread_condattr_init
1537 # define pthread_condattr_init rpl_pthread_condattr_init
1539 _GL_FUNCDECL_RPL (pthread_condattr_init
, int, (pthread_condattr_t
*attr
)
1540 _GL_ARG_NONNULL ((1)));
1541 _GL_CXXALIAS_RPL (pthread_condattr_init
, int, (pthread_condattr_t
*attr
));
1543 # if !@HAVE_PTHREAD_CONDATTR_INIT@
1544 _GL_FUNCDECL_SYS (pthread_condattr_init
, int, (pthread_condattr_t
*attr
)
1545 _GL_ARG_NONNULL ((1)));
1547 _GL_CXXALIAS_SYS (pthread_condattr_init
, int, (pthread_condattr_t
*attr
));
1550 _GL_CXXALIASWARN (pthread_condattr_init
);
1552 #elif defined GNULIB_POSIXCHECK
1553 # undef pthread_condattr_init
1554 # if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT
1555 _GL_WARN_ON_USE (pthread_condattr_init
, "pthread_condattr_init is not portable - "
1556 "use gnulib module pthread-cond for portability");
1560 #if @GNULIB_PTHREAD_COND@
1561 # if @REPLACE_PTHREAD_CONDATTR_DESTROY@
1562 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1563 # undef pthread_condattr_destroy
1564 # define pthread_condattr_destroy rpl_pthread_condattr_destroy
1566 _GL_FUNCDECL_RPL (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
)
1567 _GL_ARG_NONNULL ((1)));
1568 _GL_CXXALIAS_RPL (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
));
1570 # if !@HAVE_PTHREAD_CONDATTR_DESTROY@
1571 _GL_FUNCDECL_SYS (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
)
1572 _GL_ARG_NONNULL ((1)));
1574 _GL_CXXALIAS_SYS (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
));
1577 _GL_CXXALIASWARN (pthread_condattr_destroy
);
1579 #elif defined GNULIB_POSIXCHECK
1580 # undef pthread_condattr_destroy
1581 # if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY
1582 _GL_WARN_ON_USE (pthread_condattr_destroy
, "pthread_condattr_destroy is not portable - "
1583 "use gnulib module pthread-cond for portability");
1587 #if @GNULIB_PTHREAD_COND@
1588 # if @REPLACE_PTHREAD_COND_WAIT@
1589 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1590 # undef pthread_cond_wait
1591 # define pthread_cond_wait rpl_pthread_cond_wait
1593 _GL_FUNCDECL_RPL (pthread_cond_wait
, int,
1594 (pthread_cond_t
*restrict cond
,
1595 pthread_mutex_t
*restrict mutex
)
1596 _GL_ARG_NONNULL ((1, 2)));
1597 _GL_CXXALIAS_RPL (pthread_cond_wait
, int,
1598 (pthread_cond_t
*restrict cond
,
1599 pthread_mutex_t
*restrict mutex
));
1601 # if !@HAVE_PTHREAD_COND_WAIT@
1602 _GL_FUNCDECL_SYS (pthread_cond_wait
, int,
1603 (pthread_cond_t
*restrict cond
,
1604 pthread_mutex_t
*restrict mutex
)
1605 _GL_ARG_NONNULL ((1, 2)));
1607 _GL_CXXALIAS_SYS (pthread_cond_wait
, int,
1608 (pthread_cond_t
*restrict cond
,
1609 pthread_mutex_t
*restrict mutex
));
1612 _GL_CXXALIASWARN (pthread_cond_wait
);
1614 #elif defined GNULIB_POSIXCHECK
1615 # undef pthread_cond_wait
1616 # if HAVE_RAW_DECL_PTHREAD_COND_WAIT
1617 _GL_WARN_ON_USE (pthread_cond_wait
, "pthread_cond_wait is not portable - "
1618 "use gnulib module pthread-cond for portability");
1622 #if @GNULIB_PTHREAD_COND@
1623 # if @REPLACE_PTHREAD_COND_TIMEDWAIT@
1624 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1625 # undef pthread_cond_timedwait
1626 # define pthread_cond_timedwait rpl_pthread_cond_timedwait
1628 _GL_FUNCDECL_RPL (pthread_cond_timedwait
, int,
1629 (pthread_cond_t
*restrict cond
,
1630 pthread_mutex_t
*restrict mutex
,
1631 const struct timespec
*restrict abstime
)
1632 _GL_ARG_NONNULL ((1, 2, 3)));
1633 _GL_CXXALIAS_RPL (pthread_cond_timedwait
, int,
1634 (pthread_cond_t
*restrict cond
,
1635 pthread_mutex_t
*restrict mutex
,
1636 const struct timespec
*restrict abstime
));
1638 # if !@HAVE_PTHREAD_COND_TIMEDWAIT@
1639 _GL_FUNCDECL_SYS (pthread_cond_timedwait
, int,
1640 (pthread_cond_t
*restrict cond
,
1641 pthread_mutex_t
*restrict mutex
,
1642 const struct timespec
*restrict abstime
)
1643 _GL_ARG_NONNULL ((1, 2, 3)));
1645 _GL_CXXALIAS_SYS (pthread_cond_timedwait
, int,
1646 (pthread_cond_t
*restrict cond
,
1647 pthread_mutex_t
*restrict mutex
,
1648 const struct timespec
*restrict abstime
));
1651 _GL_CXXALIASWARN (pthread_cond_timedwait
);
1653 #elif defined GNULIB_POSIXCHECK
1654 # undef pthread_cond_timedwait
1655 # if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT
1656 _GL_WARN_ON_USE (pthread_cond_timedwait
, "pthread_cond_timedwait is not portable - "
1657 "use gnulib module pthread-cond for portability");
1661 #if @GNULIB_PTHREAD_COND@
1662 # if @REPLACE_PTHREAD_COND_SIGNAL@
1663 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1664 # undef pthread_cond_signal
1665 # define pthread_cond_signal rpl_pthread_cond_signal
1667 _GL_FUNCDECL_RPL (pthread_cond_signal
, int, (pthread_cond_t
*cond
)
1668 _GL_ARG_NONNULL ((1)));
1669 _GL_CXXALIAS_RPL (pthread_cond_signal
, int, (pthread_cond_t
*cond
));
1671 # if !@HAVE_PTHREAD_COND_SIGNAL@
1672 _GL_FUNCDECL_SYS (pthread_cond_signal
, int, (pthread_cond_t
*cond
)
1673 _GL_ARG_NONNULL ((1)));
1675 _GL_CXXALIAS_SYS (pthread_cond_signal
, int, (pthread_cond_t
*cond
));
1678 _GL_CXXALIASWARN (pthread_cond_signal
);
1680 #elif defined GNULIB_POSIXCHECK
1681 # undef pthread_cond_signal
1682 # if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL
1683 _GL_WARN_ON_USE (pthread_cond_signal
, "pthread_cond_signal is not portable - "
1684 "use gnulib module pthread-cond for portability");
1688 #if @GNULIB_PTHREAD_COND@
1689 # if @REPLACE_PTHREAD_COND_BROADCAST@
1690 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1691 # undef pthread_cond_broadcast
1692 # define pthread_cond_broadcast rpl_pthread_cond_broadcast
1694 _GL_FUNCDECL_RPL (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
)
1695 _GL_ARG_NONNULL ((1)));
1696 _GL_CXXALIAS_RPL (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
));
1698 # if !@HAVE_PTHREAD_COND_BROADCAST@
1699 _GL_FUNCDECL_SYS (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
)
1700 _GL_ARG_NONNULL ((1)));
1702 _GL_CXXALIAS_SYS (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
));
1705 _GL_CXXALIASWARN (pthread_cond_broadcast
);
1707 #elif defined GNULIB_POSIXCHECK
1708 # undef pthread_cond_broadcast
1709 # if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST
1710 _GL_WARN_ON_USE (pthread_cond_broadcast
, "pthread_cond_broadcast is not portable - "
1711 "use gnulib module pthread-cond for portability");
1715 #if @GNULIB_PTHREAD_COND@
1716 # if @REPLACE_PTHREAD_COND_DESTROY@
1717 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1718 # undef pthread_cond_destroy
1719 # define pthread_cond_destroy rpl_pthread_cond_destroy
1721 _GL_FUNCDECL_RPL (pthread_cond_destroy
, int, (pthread_cond_t
*cond
)
1722 _GL_ARG_NONNULL ((1)));
1723 _GL_CXXALIAS_RPL (pthread_cond_destroy
, int, (pthread_cond_t
*cond
));
1725 # if !@HAVE_PTHREAD_COND_DESTROY@
1726 _GL_FUNCDECL_SYS (pthread_cond_destroy
, int, (pthread_cond_t
*cond
)
1727 _GL_ARG_NONNULL ((1)));
1729 _GL_CXXALIAS_SYS (pthread_cond_destroy
, int, (pthread_cond_t
*cond
));
1732 _GL_CXXALIASWARN (pthread_cond_destroy
);
1734 #elif defined GNULIB_POSIXCHECK
1735 # undef pthread_cond_destroy
1736 # if HAVE_RAW_DECL_PTHREAD_COND_DESTROY
1737 _GL_WARN_ON_USE (pthread_cond_destroy
, "pthread_cond_destroy is not portable - "
1738 "use gnulib module pthread-cond for portability");
1742 /* =========== Thread-specific storage functions =========== */
1744 #if @GNULIB_PTHREAD_TSS@
1745 # if @REPLACE_PTHREAD_KEY_CREATE@
1746 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1747 # undef pthread_key_create
1748 # define pthread_key_create rpl_pthread_key_create
1750 _GL_FUNCDECL_RPL (pthread_key_create
, int,
1751 (pthread_key_t
*keyp
, void (*destructor
) (void *))
1752 _GL_ARG_NONNULL ((1)));
1753 _GL_CXXALIAS_RPL (pthread_key_create
, int,
1754 (pthread_key_t
*keyp
, void (*destructor
) (void *)));
1756 # if !@HAVE_PTHREAD_KEY_CREATE@
1757 _GL_FUNCDECL_SYS (pthread_key_create
, int,
1758 (pthread_key_t
*keyp
, void (*destructor
) (void *))
1759 _GL_ARG_NONNULL ((1)));
1761 _GL_CXXALIAS_SYS_CAST (pthread_key_create
, int,
1762 (pthread_key_t
*keyp
, void (*destructor
) (void *)));
1765 _GL_CXXALIASWARN (pthread_key_create
);
1767 #elif defined GNULIB_POSIXCHECK
1768 # undef pthread_key_create
1769 # if HAVE_RAW_DECL_PTHREAD_KEY_CREATE
1770 _GL_WARN_ON_USE (pthread_key_create
, "pthread_key_create is not portable - "
1771 "use gnulib module pthread-tss for portability");
1775 #if @GNULIB_PTHREAD_TSS@
1776 # if @REPLACE_PTHREAD_SETSPECIFIC@
1777 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1778 # undef pthread_setspecific
1779 # define pthread_setspecific rpl_pthread_setspecific
1781 _GL_FUNCDECL_RPL (pthread_setspecific
, int,
1782 (pthread_key_t key
, const void *value
));
1783 _GL_CXXALIAS_RPL (pthread_setspecific
, int,
1784 (pthread_key_t key
, const void *value
));
1786 # if !@HAVE_PTHREAD_SETSPECIFIC@
1787 _GL_FUNCDECL_SYS (pthread_setspecific
, int,
1788 (pthread_key_t key
, const void *value
));
1790 _GL_CXXALIAS_SYS (pthread_setspecific
, int,
1791 (pthread_key_t key
, const void *value
));
1794 _GL_CXXALIASWARN (pthread_setspecific
);
1796 #elif defined GNULIB_POSIXCHECK
1797 # undef pthread_setspecific
1798 # if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC
1799 _GL_WARN_ON_USE (pthread_setspecific
, "pthread_setspecific is not portable - "
1800 "use gnulib module pthread-tss for portability");
1804 #if @GNULIB_PTHREAD_TSS@
1805 # if @REPLACE_PTHREAD_GETSPECIFIC@
1806 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1807 # undef pthread_getspecific
1808 # define pthread_getspecific rpl_pthread_getspecific
1810 _GL_FUNCDECL_RPL (pthread_getspecific
, void *, (pthread_key_t key
));
1811 _GL_CXXALIAS_RPL (pthread_getspecific
, void *, (pthread_key_t key
));
1813 # if !@HAVE_PTHREAD_GETSPECIFIC@
1814 _GL_FUNCDECL_SYS (pthread_getspecific
, void *, (pthread_key_t key
));
1816 _GL_CXXALIAS_SYS (pthread_getspecific
, void *, (pthread_key_t key
));
1819 _GL_CXXALIASWARN (pthread_getspecific
);
1821 #elif defined GNULIB_POSIXCHECK
1822 # undef pthread_getspecific
1823 # if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC
1824 _GL_WARN_ON_USE (pthread_getspecific
, "pthread_getspecific is not portable - "
1825 "use gnulib module pthread-tss for portability");
1829 #if @GNULIB_PTHREAD_TSS@
1830 # if @REPLACE_PTHREAD_KEY_DELETE@
1831 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1832 # undef pthread_key_delete
1833 # define pthread_key_delete rpl_pthread_key_delete
1835 _GL_FUNCDECL_RPL (pthread_key_delete
, int, (pthread_key_t key
));
1836 _GL_CXXALIAS_RPL (pthread_key_delete
, int, (pthread_key_t key
));
1838 # if !@HAVE_PTHREAD_KEY_DELETE@
1839 _GL_FUNCDECL_SYS (pthread_key_delete
, int, (pthread_key_t key
));
1841 _GL_CXXALIAS_SYS (pthread_key_delete
, int, (pthread_key_t key
));
1844 _GL_CXXALIASWARN (pthread_key_delete
);
1846 #elif defined GNULIB_POSIXCHECK
1847 # undef pthread_key_delete
1848 # if HAVE_RAW_DECL_PTHREAD_KEY_DELETE
1849 _GL_WARN_ON_USE (pthread_key_delete
, "pthread_key_delete is not portable - "
1850 "use gnulib module pthread-tss for portability");
1854 /* =========== Spinlock functions =========== */
1856 #if @GNULIB_PTHREAD_SPIN@
1857 # if @REPLACE_PTHREAD_SPIN_INIT@
1858 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1859 # undef pthread_spin_init
1860 # define pthread_spin_init rpl_pthread_spin_init
1862 _GL_FUNCDECL_RPL (pthread_spin_init
, int,
1863 (pthread_spinlock_t
*lock
, int shared_across_processes
)
1864 _GL_ARG_NONNULL ((1)));
1865 _GL_CXXALIAS_RPL (pthread_spin_init
, int,
1866 (pthread_spinlock_t
*lock
, int shared_across_processes
));
1868 # if !@HAVE_PTHREAD_SPIN_INIT@
1869 _GL_FUNCDECL_SYS (pthread_spin_init
, int,
1870 (pthread_spinlock_t
*lock
, int shared_across_processes
)
1871 _GL_ARG_NONNULL ((1)));
1873 _GL_CXXALIAS_SYS (pthread_spin_init
, int,
1874 (pthread_spinlock_t
*lock
, int shared_across_processes
));
1877 _GL_CXXALIASWARN (pthread_spin_init
);
1879 #elif defined GNULIB_POSIXCHECK
1880 # undef pthread_spin_init
1881 # if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
1882 _GL_WARN_ON_USE (pthread_spin_init
, "pthread_spin_init is not portable - "
1883 "use gnulib module pthread-spin for portability");
1887 #if @GNULIB_PTHREAD_SPIN@
1888 # if @REPLACE_PTHREAD_SPIN_LOCK@
1889 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1890 # undef pthread_spin_lock
1891 # define pthread_spin_lock rpl_pthread_spin_lock
1893 _GL_FUNCDECL_RPL (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
)
1894 _GL_ARG_NONNULL ((1)));
1895 _GL_CXXALIAS_RPL (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
));
1897 # if !@HAVE_PTHREAD_SPIN_LOCK@
1898 _GL_FUNCDECL_SYS (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
)
1899 _GL_ARG_NONNULL ((1)));
1901 _GL_CXXALIAS_SYS (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
));
1904 _GL_CXXALIASWARN (pthread_spin_lock
);
1906 #elif defined GNULIB_POSIXCHECK
1907 # undef pthread_spin_lock
1908 # if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
1909 _GL_WARN_ON_USE (pthread_spin_lock
, "pthread_spin_lock is not portable - "
1910 "use gnulib module pthread-spin for portability");
1914 #if @GNULIB_PTHREAD_SPIN@
1915 # if @REPLACE_PTHREAD_SPIN_TRYLOCK@
1916 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1917 # undef pthread_spin_trylock
1918 # define pthread_spin_trylock rpl_pthread_spin_trylock
1920 _GL_FUNCDECL_RPL (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
)
1921 _GL_ARG_NONNULL ((1)));
1922 _GL_CXXALIAS_RPL (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
));
1924 # if !@HAVE_PTHREAD_SPIN_TRYLOCK@
1925 _GL_FUNCDECL_SYS (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
)
1926 _GL_ARG_NONNULL ((1)));
1928 _GL_CXXALIAS_SYS (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
));
1931 _GL_CXXALIASWARN (pthread_spin_trylock
);
1933 #elif defined GNULIB_POSIXCHECK
1934 # undef pthread_spin_trylock
1935 # if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
1936 _GL_WARN_ON_USE (pthread_spin_trylock
, "pthread_spin_trylock is not portable - "
1937 "use gnulib module pthread-spin for portability");
1941 #if @GNULIB_PTHREAD_SPIN@
1942 # if @REPLACE_PTHREAD_SPIN_UNLOCK@
1943 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1944 # undef pthread_spin_unlock
1945 # define pthread_spin_unlock rpl_pthread_spin_unlock
1947 _GL_FUNCDECL_RPL (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
)
1948 _GL_ARG_NONNULL ((1)));
1949 _GL_CXXALIAS_RPL (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
));
1951 # if !@HAVE_PTHREAD_SPIN_UNLOCK@
1952 _GL_FUNCDECL_SYS (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
)
1953 _GL_ARG_NONNULL ((1)));
1955 _GL_CXXALIAS_SYS (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
));
1958 _GL_CXXALIASWARN (pthread_spin_unlock
);
1960 #elif defined GNULIB_POSIXCHECK
1961 # undef pthread_spin_unlock
1962 # if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
1963 _GL_WARN_ON_USE (pthread_spin_unlock
, "pthread_spin_unlock is not portable - "
1964 "use gnulib module pthread-spin for portability");
1968 #if @GNULIB_PTHREAD_SPIN@
1969 # if @REPLACE_PTHREAD_SPIN_DESTROY@
1970 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1971 # undef pthread_spin_destroy
1972 # define pthread_spin_destroy rpl_pthread_spin_destroy
1974 _GL_FUNCDECL_RPL (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
)
1975 _GL_ARG_NONNULL ((1)));
1976 _GL_CXXALIAS_RPL (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
));
1978 # if !@HAVE_PTHREAD_SPIN_DESTROY@
1979 _GL_FUNCDECL_SYS (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
)
1980 _GL_ARG_NONNULL ((1)));
1982 _GL_CXXALIAS_SYS (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
));
1985 _GL_CXXALIASWARN (pthread_spin_destroy
);
1987 #elif defined GNULIB_POSIXCHECK
1988 # undef pthread_spin_destroy
1989 # if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
1990 _GL_WARN_ON_USE (pthread_spin_destroy
, "pthread_spin_destroy is not portable - "
1991 "use gnulib module pthread-spin for portability");
1996 #if defined __cplusplus && defined GNULIB_NAMESPACE && !@HAVE_PTHREAD_H@ && defined __MINGW32__
1997 /* Provide the symbols required by mingw's <bits/gthr-default.h>. */
1998 using GNULIB_NAMESPACE::pthread_create
;
1999 using GNULIB_NAMESPACE::pthread_self
;
2000 using GNULIB_NAMESPACE::pthread_equal
;
2001 using GNULIB_NAMESPACE::pthread_detach
;
2002 using GNULIB_NAMESPACE::pthread_join
;
2003 using GNULIB_NAMESPACE::pthread_once
;
2004 using GNULIB_NAMESPACE::pthread_mutex_init
;
2005 using GNULIB_NAMESPACE::pthread_mutexattr_init
;
2006 using GNULIB_NAMESPACE::pthread_mutexattr_settype
;
2007 using GNULIB_NAMESPACE::pthread_mutexattr_destroy
;
2008 using GNULIB_NAMESPACE::pthread_mutex_lock
;
2009 using GNULIB_NAMESPACE::pthread_mutex_trylock
;
2010 using GNULIB_NAMESPACE::pthread_mutex_timedlock
;
2011 using GNULIB_NAMESPACE::pthread_mutex_unlock
;
2012 using GNULIB_NAMESPACE::pthread_mutex_destroy
;
2013 using GNULIB_NAMESPACE::pthread_cond_wait
;
2014 using GNULIB_NAMESPACE::pthread_cond_timedwait
;
2015 using GNULIB_NAMESPACE::pthread_cond_signal
;
2016 using GNULIB_NAMESPACE::pthread_cond_broadcast
;
2017 using GNULIB_NAMESPACE::pthread_cond_destroy
;
2018 using GNULIB_NAMESPACE::pthread_key_create
;
2019 using GNULIB_NAMESPACE::pthread_setspecific
;
2020 using GNULIB_NAMESPACE::pthread_getspecific
;
2021 using GNULIB_NAMESPACE::pthread_key_delete
;
2025 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
2026 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */