1 /* Implement the most essential subset of POSIX 1003.1-2008 pthread.h.
3 Copyright (C) 2009-2020 Free Software Foundation, Inc.
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 2, or (at your option)
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.
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/>. */
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 #define __need_system_stdlib_h
56 #undef __need_system_stdlib_h
59 /* The pthreads-win32 <pthread.h> defines a couple of broken macros. */
69 #include <sys/types.h>
72 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
74 /* The definition of _Noreturn is copied here. */
76 /* The definition of _GL_ARG_NONNULL is copied here. */
78 /* The definition of _GL_WARN_ON_USE is copied here. */
80 /* =========== Thread types and macros =========== */
82 #if (defined _WIN32 && ! defined __CYGWIN__) && USE_WINDOWS_THREADS
83 # if @GNULIB_PTHREAD_THREAD@
84 # include "windows-thread.h"
86 # define pthread_t rpl_pthread_t
87 # define pthread_attr_t rpl_pthread_attr_t
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
96 # define pthread_t rpl_pthread_t
97 # define pthread_attr_t rpl_pthread_attr_t
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
105 # undef PTHREAD_CREATE_JOINABLE
106 # undef PTHREAD_CREATE_DETACHED
107 # define PTHREAD_CREATE_JOINABLE 0
108 # define PTHREAD_CREATE_DETACHED 1
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
117 # if !@HAVE_PTHREAD_CREATE_DETACHED@
118 # define PTHREAD_CREATE_JOINABLE 0
119 # define PTHREAD_CREATE_DETACHED 1
123 /* =========== Once-only control (initialization) types and macros ========== */
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
131 # if !GNULIB_defined_pthread_once_types
132 typedef glwthread_once_t pthread_once_t
;
133 # define GNULIB_defined_pthread_once_types 1
135 # undef PTHREAD_ONCE_INIT
136 # define PTHREAD_ONCE_INIT GLWTHREAD_ONCE_INIT
138 # if @HAVE_PTHREAD_T@
139 # define pthread_once_t rpl_pthread_once_t
141 # if !GNULIB_defined_pthread_once_types
142 typedef int pthread_once_t
;
143 # define GNULIB_defined_pthread_once_types 1
145 # undef PTHREAD_ONCE_INIT
146 # define PTHREAD_ONCE_INIT { 0 }
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
154 # undef PTHREAD_ONCE_INIT
155 # define PTHREAD_ONCE_INIT { 0 }
159 /* =========== Mutex types and macros =========== */
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
169 # if !GNULIB_defined_pthread_mutex_types
175 glwthread_timedmutex_t u_timedmutex
;
176 glwthread_timedrecmutex_t u_timedrecmutex
;
181 typedef unsigned int pthread_mutexattr_t
;
182 # define GNULIB_defined_pthread_mutex_types 1
184 # undef PTHREAD_MUTEX_INITIALIZER
185 # define PTHREAD_MUTEX_INITIALIZER { 1, { GLWTHREAD_TIMEDMUTEX_INIT } }
187 # if @HAVE_PTHREAD_T@
188 # define pthread_mutex_t rpl_pthread_mutex_t
189 # define pthread_mutexattr_t rpl_pthread_mutexattr_t
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
196 # undef PTHREAD_MUTEX_INITIALIZER
197 # define PTHREAD_MUTEX_INITIALIZER { 0 }
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
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
218 # undef PTHREAD_MUTEX_INITIALIZER
219 # define PTHREAD_MUTEX_INITIALIZER { 0 }
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
227 # if !@HAVE_PTHREAD_MUTEX_ROBUST@
228 # define PTHREAD_MUTEX_STALLED 0
229 # define PTHREAD_MUTEX_ROBUST 1
233 /* =========== Read-write lock types and macros =========== */
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
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
247 # undef PTHREAD_RWLOCK_INITIALIZER
248 # define PTHREAD_RWLOCK_INITIALIZER GLWTHREAD_TIMEDRWLOCK_INIT
250 # if @HAVE_PTHREAD_T@
251 # define pthread_rwlock_t rpl_pthread_rwlock_t
252 # define pthread_rwlockattr_t rpl_pthread_rwlockattr_t
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
259 # undef PTHREAD_RWLOCK_INITIALIZER
260 # define PTHREAD_RWLOCK_INITIALIZER { 0 }
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
267 # if !GNULIB_defined_pthread_rwlock_types
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 */
277 typedef unsigned int pthread_rwlockattr_t
;
278 # define GNULIB_defined_pthread_rwlock_types 1
280 # undef PTHREAD_RWLOCK_INITIALIZER
281 # define PTHREAD_RWLOCK_INITIALIZER \
282 { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
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
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
294 # undef PTHREAD_RWLOCK_INITIALIZER
295 # define PTHREAD_RWLOCK_INITIALIZER { 0 }
299 /* =========== Condition variable types and macros =========== */
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
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
313 # undef PTHREAD_COND_INITIALIZER
314 # define PTHREAD_COND_INITIALIZER GLWTHREAD_COND_INIT
316 # if @HAVE_PTHREAD_T@
317 # define pthread_cond_t rpl_pthread_cond_t
318 # define pthread_condattr_t rpl_pthread_condattr_t
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
325 # undef PTHREAD_COND_INITIALIZER
326 # define PTHREAD_COND_INITIALIZER { 0 }
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
335 # undef PTHREAD_COND_INITIALIZER
336 # define PTHREAD_COND_INITIALIZER { 0 }
340 /* =========== Thread-specific storage types and macros =========== */
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
348 # if !GNULIB_defined_pthread_tss_types
349 typedef glwthread_tls_key_t pthread_key_t
;
350 # define GNULIB_defined_pthread_tss_types 1
352 # undef PTHREAD_DESTRUCTOR_ITERATIONS
353 # define PTHREAD_DESTRUCTOR_ITERATIONS GLWTHREAD_DESTRUCTOR_ITERATIONS
355 # if @HAVE_PTHREAD_T@
356 # define pthread_key_t rpl_pthread_key_t
358 # if !GNULIB_defined_pthread_tss_types
359 typedef void ** pthread_key_t
;
360 # define GNULIB_defined_pthread_tss_types 1
362 # undef PTHREAD_DESTRUCTOR_ITERATIONS
363 # define PTHREAD_DESTRUCTOR_ITERATIONS 0
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
371 # undef PTHREAD_DESTRUCTOR_ITERATIONS
372 # define PTHREAD_DESTRUCTOR_ITERATIONS 0
376 /* =========== Spinlock types and macros =========== */
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
384 # if !GNULIB_defined_pthread_spin_types
385 typedef glwthread_spinlock_t pthread_spinlock_t
;
386 # define GNULIB_defined_pthread_spin_types 1
389 # if @HAVE_PTHREAD_T@
390 # define pthread_spinlock_t rpl_pthread_spinlock_t
392 # if !GNULIB_defined_pthread_spin_types
393 typedef pthread_mutex_t pthread_spinlock_t
;
394 # define GNULIB_defined_pthread_spin_types 1
397 # undef PTHREAD_PROCESS_PRIVATE
398 # undef PTHREAD_PROCESS_SHARED
399 # define PTHREAD_PROCESS_PRIVATE 0
400 # define PTHREAD_PROCESS_SHARED 1
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
409 # if !@HAVE_PTHREAD_PROCESS_SHARED@
410 # define PTHREAD_PROCESS_PRIVATE 0
411 # define PTHREAD_PROCESS_SHARED 1
415 /* =========== Other types and macros =========== */
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
425 #if !defined PTHREAD_CANCELED
427 # define PTHREAD_BARRIER_SERIAL_THREAD (-1)
429 # define PTHREAD_CANCEL_DEFERRED 0
430 # define PTHREAD_CANCEL_ASYNCHRONOUS 1
432 # define PTHREAD_CANCEL_ENABLE 0
433 # define PTHREAD_CANCEL_DISABLE 1
435 # define PTHREAD_CANCELED ((void *) -1)
437 # define PTHREAD_INHERIT_SCHED 0
438 # define PTHREAD_EXPLICIT_SCHED 1
440 # define PTHREAD_PRIO_NONE 0
441 # define PTHREAD_PRIO_INHERIT 1
442 # define PTHREAD_PRIO_PROTECT 2
444 # define PTHREAD_SCOPE_SYSTEM 0
445 # define PTHREAD_SCOPE_PROCESS 1
449 /* =========== Thread functions =========== */
451 #if @GNULIB_PTHREAD_THREAD@
452 /* The 'restrict' qualifier on ARG is nonsense, but POSIX specifies it this way.
454 # if @REPLACE_PTHREAD_CREATE@
455 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
456 # undef pthread_create
457 # define pthread_create rpl_pthread_create
459 _GL_FUNCDECL_RPL (pthread_create
, int,
460 (pthread_t
*restrict threadp
,
461 const pthread_attr_t
*restrict attr
,
462 void * (*mainfunc
) (void *), void *restrict arg
)
463 _GL_ARG_NONNULL ((1, 3)));
464 _GL_CXXALIAS_RPL (pthread_create
, int,
465 (pthread_t
*restrict threadp
,
466 const pthread_attr_t
*restrict attr
,
467 void * (*mainfunc
) (void *), void *restrict arg
));
469 # if !@HAVE_PTHREAD_CREATE@
470 _GL_FUNCDECL_SYS (pthread_create
, int,
471 (pthread_t
*restrict threadp
,
472 const pthread_attr_t
*restrict attr
,
473 void * (*mainfunc
) (void *), void *restrict arg
)
474 _GL_ARG_NONNULL ((1, 3)));
476 _GL_CXXALIAS_SYS_CAST (pthread_create
, int,
477 (pthread_t
*restrict threadp
,
478 const pthread_attr_t
*restrict attr
,
479 void * (*mainfunc
) (void *), void *restrict arg
));
482 _GL_CXXALIASWARN (pthread_create
);
484 #elif defined GNULIB_POSIXCHECK
485 # undef pthread_create
486 # if HAVE_RAW_DECL_PTHREAD_CREATE
487 _GL_WARN_ON_USE (pthread_create
, "pthread_create is not portable - "
488 "use gnulib module pthread-thread for portability");
492 #if @GNULIB_PTHREAD_THREAD@
493 # if @REPLACE_PTHREAD_ATTR_INIT@
494 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
495 # undef pthread_attr_init
496 # define pthread_attr_init rpl_pthread_attr_init
498 _GL_FUNCDECL_RPL (pthread_attr_init
, int, (pthread_attr_t
*attr
)
499 _GL_ARG_NONNULL ((1)));
500 _GL_CXXALIAS_RPL (pthread_attr_init
, int, (pthread_attr_t
*attr
));
502 # if !@HAVE_PTHREAD_ATTR_INIT@
503 _GL_FUNCDECL_SYS (pthread_attr_init
, int, (pthread_attr_t
*attr
)
504 _GL_ARG_NONNULL ((1)));
506 _GL_CXXALIAS_SYS (pthread_attr_init
, int, (pthread_attr_t
*attr
));
509 _GL_CXXALIASWARN (pthread_attr_init
);
511 #elif defined GNULIB_POSIXCHECK
512 # undef pthread_attr_init
513 # if HAVE_RAW_DECL_PTHREAD_ATTR_INIT
514 _GL_WARN_ON_USE (pthread_attr_init
, "pthread_attr_init is not portable - "
515 "use gnulib module pthread-thread for portability");
519 #if @GNULIB_PTHREAD_THREAD@
520 # if @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@
521 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
522 # undef pthread_attr_getdetachstate
523 # define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
525 _GL_FUNCDECL_RPL (pthread_attr_getdetachstate
, int,
526 (const pthread_attr_t
*attr
, int *detachstatep
)
527 _GL_ARG_NONNULL ((1, 2)));
528 _GL_CXXALIAS_RPL (pthread_attr_getdetachstate
, int,
529 (const pthread_attr_t
*attr
, int *detachstatep
));
531 # if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@
532 _GL_FUNCDECL_SYS (pthread_attr_getdetachstate
, int,
533 (const pthread_attr_t
*attr
, int *detachstatep
)
534 _GL_ARG_NONNULL ((1, 2)));
536 _GL_CXXALIAS_SYS (pthread_attr_getdetachstate
, int,
537 (const pthread_attr_t
*attr
, int *detachstatep
));
540 _GL_CXXALIASWARN (pthread_attr_getdetachstate
);
542 #elif defined GNULIB_POSIXCHECK
543 # undef pthread_attr_getdetachstate
544 # if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE
545 _GL_WARN_ON_USE (pthread_attr_getdetachstate
, "pthread_attr_getdetachstate is not portable - "
546 "use gnulib module pthread-thread for portability");
550 #if @GNULIB_PTHREAD_THREAD@
551 # if @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@
552 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
553 # undef pthread_attr_setdetachstate
554 # define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
556 _GL_FUNCDECL_RPL (pthread_attr_setdetachstate
, int,
557 (pthread_attr_t
*attr
, int detachstate
)
558 _GL_ARG_NONNULL ((1)));
559 _GL_CXXALIAS_RPL (pthread_attr_setdetachstate
, int,
560 (pthread_attr_t
*attr
, int detachstate
));
562 # if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@
563 _GL_FUNCDECL_SYS (pthread_attr_setdetachstate
, int,
564 (pthread_attr_t
*attr
, int detachstate
)
565 _GL_ARG_NONNULL ((1)));
567 _GL_CXXALIAS_SYS (pthread_attr_setdetachstate
, int,
568 (pthread_attr_t
*attr
, int detachstate
));
571 _GL_CXXALIASWARN (pthread_attr_setdetachstate
);
573 #elif defined GNULIB_POSIXCHECK
574 # undef pthread_attr_setdetachstate
575 # if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE
576 _GL_WARN_ON_USE (pthread_attr_setdetachstate
, "pthread_attr_setdetachstate is not portable - "
577 "use gnulib module pthread-thread for portability");
581 #if @GNULIB_PTHREAD_THREAD@
582 # if @REPLACE_PTHREAD_ATTR_DESTROY@
583 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
584 # undef pthread_attr_destroy
585 # define pthread_attr_destroy rpl_pthread_attr_destroy
587 _GL_FUNCDECL_RPL (pthread_attr_destroy
, int, (pthread_attr_t
*attr
)
588 _GL_ARG_NONNULL ((1)));
589 _GL_CXXALIAS_RPL (pthread_attr_destroy
, int, (pthread_attr_t
*attr
));
591 # if !@HAVE_PTHREAD_ATTR_DESTROY@
592 _GL_FUNCDECL_SYS (pthread_attr_destroy
, int, (pthread_attr_t
*attr
)
593 _GL_ARG_NONNULL ((1)));
595 _GL_CXXALIAS_SYS (pthread_attr_destroy
, int, (pthread_attr_t
*attr
));
598 _GL_CXXALIASWARN (pthread_attr_destroy
);
600 #elif defined GNULIB_POSIXCHECK
601 # undef pthread_attr_destroy
602 # if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY
603 _GL_WARN_ON_USE (pthread_attr_destroy
, "pthread_attr_destroy is not portable - "
604 "use gnulib module pthread-thread for portability");
608 #if @GNULIB_PTHREAD_THREAD@
609 # if @REPLACE_PTHREAD_SELF@
610 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
612 # define pthread_self rpl_pthread_self
614 _GL_FUNCDECL_RPL (pthread_self
, pthread_t
, (void) _GL_ATTRIBUTE_PURE
);
615 _GL_CXXALIAS_RPL (pthread_self
, pthread_t
, (void));
617 # if !@HAVE_PTHREAD_SELF@
618 _GL_FUNCDECL_SYS (pthread_self
, pthread_t
, (void) _GL_ATTRIBUTE_PURE
);
620 _GL_CXXALIAS_SYS (pthread_self
, pthread_t
, (void));
623 _GL_CXXALIASWARN (pthread_self
);
625 #elif defined GNULIB_POSIXCHECK
627 # if HAVE_RAW_DECL_PTHREAD_SELF
628 _GL_WARN_ON_USE (pthread_self
, "pthread_self is not portable - "
629 "use gnulib module pthread-thread for portability");
633 #if @GNULIB_PTHREAD_THREAD@
634 # if @REPLACE_PTHREAD_EQUAL@
635 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
636 # undef pthread_equal
637 # define pthread_equal rpl_pthread_equal
639 _GL_FUNCDECL_RPL (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
640 _GL_CXXALIAS_RPL (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
642 # if !@HAVE_PTHREAD_EQUAL@
643 _GL_FUNCDECL_SYS (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
645 _GL_CXXALIAS_SYS (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
648 _GL_CXXALIASWARN (pthread_equal
);
650 #elif defined GNULIB_POSIXCHECK
651 # undef pthread_equal
652 # if HAVE_RAW_DECL_PTHREAD_EQUAL
653 _GL_WARN_ON_USE (pthread_equal
, "pthread_equal is not portable - "
654 "use gnulib module pthread-thread for portability");
658 #if @GNULIB_PTHREAD_THREAD@
659 # if @REPLACE_PTHREAD_DETACH@
660 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
661 # undef pthread_detach
662 # define pthread_detach rpl_pthread_detach
664 _GL_FUNCDECL_RPL (pthread_detach
, int, (pthread_t thread
));
665 _GL_CXXALIAS_RPL (pthread_detach
, int, (pthread_t thread
));
667 # if !@HAVE_PTHREAD_DETACH@
668 _GL_FUNCDECL_SYS (pthread_detach
, int, (pthread_t thread
));
670 _GL_CXXALIAS_SYS (pthread_detach
, int, (pthread_t thread
));
673 _GL_CXXALIASWARN (pthread_detach
);
675 #elif defined GNULIB_POSIXCHECK
676 # undef pthread_detach
677 # if HAVE_RAW_DECL_PTHREAD_DETACH
678 _GL_WARN_ON_USE (pthread_detach
, "pthread_detach is not portable - "
679 "use gnulib module pthread-thread for portability");
683 #if @GNULIB_PTHREAD_THREAD@
684 # if @REPLACE_PTHREAD_JOIN@
685 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
687 # define pthread_join rpl_pthread_join
689 _GL_FUNCDECL_RPL (pthread_join
, int, (pthread_t thread
, void **valuep
));
690 _GL_CXXALIAS_RPL (pthread_join
, int, (pthread_t thread
, void **valuep
));
692 # if !@HAVE_PTHREAD_JOIN@
693 _GL_FUNCDECL_SYS (pthread_join
, int, (pthread_t thread
, void **valuep
));
695 _GL_CXXALIAS_SYS (pthread_join
, int, (pthread_t thread
, void **valuep
));
698 _GL_CXXALIASWARN (pthread_join
);
700 #elif defined GNULIB_POSIXCHECK
702 # if HAVE_RAW_DECL_PTHREAD_JOIN
703 _GL_WARN_ON_USE (pthread_join
, "pthread_join is not portable - "
704 "use gnulib module pthread-thread for portability");
708 #if @GNULIB_PTHREAD_THREAD@
709 # if @REPLACE_PTHREAD_EXIT@
710 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
712 # define pthread_exit rpl_pthread_exit
714 _GL_FUNCDECL_RPL (pthread_exit
, _Noreturn
void, (void *value
));
715 _GL_CXXALIAS_RPL (pthread_exit
, void, (void *value
));
717 # if !@HAVE_PTHREAD_EXIT@
718 _GL_FUNCDECL_SYS (pthread_exit
, _Noreturn
void, (void *value
));
720 /* Need to cast because of AIX with xlclang++. */
721 _GL_CXXALIAS_SYS_CAST (pthread_exit
, void, (void *value
));
724 _GL_CXXALIASWARN (pthread_exit
);
726 #elif defined GNULIB_POSIXCHECK
728 # if HAVE_RAW_DECL_PTHREAD_EXIT
729 _GL_WARN_ON_USE (pthread_exit
, "pthread_exit is not portable - "
730 "use gnulib module pthread-thread for portability");
734 /* =========== Once-only control (initialization) functions =========== */
736 #if @GNULIB_PTHREAD_ONCE@
737 # if @REPLACE_PTHREAD_ONCE@
738 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
740 # define pthread_once rpl_pthread_once
742 _GL_FUNCDECL_RPL (pthread_once
, int,
743 (pthread_once_t
*once_control
, void (*initfunction
) (void))
744 _GL_ARG_NONNULL ((1, 2)));
745 _GL_CXXALIAS_RPL (pthread_once
, int,
746 (pthread_once_t
*once_control
, void (*initfunction
) (void)));
748 # if !@HAVE_PTHREAD_ONCE@
749 _GL_FUNCDECL_SYS (pthread_once
, int,
750 (pthread_once_t
*once_control
, void (*initfunction
) (void))
751 _GL_ARG_NONNULL ((1, 2)));
753 _GL_CXXALIAS_SYS_CAST (pthread_once
, int,
754 (pthread_once_t
*once_control
,
755 void (*initfunction
) (void)));
758 _GL_CXXALIASWARN (pthread_once
);
760 #elif defined GNULIB_POSIXCHECK
762 # if HAVE_RAW_DECL_PTHREAD_ONCE
763 _GL_WARN_ON_USE (pthread_once
, "pthread_once is not portable - "
764 "use gnulib module pthread-once for portability");
768 /* =========== Mutex functions =========== */
770 #if @GNULIB_PTHREAD_MUTEX@
771 # if @REPLACE_PTHREAD_MUTEX_INIT@
772 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
773 # undef pthread_mutex_init
774 # define pthread_mutex_init rpl_pthread_mutex_init
776 _GL_FUNCDECL_RPL (pthread_mutex_init
, int,
777 (pthread_mutex_t
*restrict mutex
,
778 const pthread_mutexattr_t
*restrict attr
)
779 _GL_ARG_NONNULL ((1)));
780 _GL_CXXALIAS_RPL (pthread_mutex_init
, int,
781 (pthread_mutex_t
*restrict mutex
,
782 const pthread_mutexattr_t
*restrict attr
));
784 # if !@HAVE_PTHREAD_MUTEX_INIT@
785 _GL_FUNCDECL_SYS (pthread_mutex_init
, int,
786 (pthread_mutex_t
*restrict mutex
,
787 const pthread_mutexattr_t
*restrict attr
)
788 _GL_ARG_NONNULL ((1)));
790 _GL_CXXALIAS_SYS (pthread_mutex_init
, int,
791 (pthread_mutex_t
*restrict mutex
,
792 const pthread_mutexattr_t
*restrict attr
));
795 _GL_CXXALIASWARN (pthread_mutex_init
);
797 #elif defined GNULIB_POSIXCHECK
798 # undef pthread_mutex_init
799 # if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT
800 _GL_WARN_ON_USE (pthread_mutex_init
, "pthread_mutex_init is not portable - "
801 "use gnulib module pthread-mutex for portability");
805 #if @GNULIB_PTHREAD_MUTEX@
806 # if @REPLACE_PTHREAD_MUTEXATTR_INIT@
807 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
808 # undef pthread_mutexattr_init
809 # define pthread_mutexattr_init rpl_pthread_mutexattr_init
811 _GL_FUNCDECL_RPL (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
)
812 _GL_ARG_NONNULL ((1)));
813 _GL_CXXALIAS_RPL (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
));
815 # if !@HAVE_PTHREAD_MUTEXATTR_INIT@
816 _GL_FUNCDECL_SYS (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
)
817 _GL_ARG_NONNULL ((1)));
819 _GL_CXXALIAS_SYS (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
));
822 _GL_CXXALIASWARN (pthread_mutexattr_init
);
824 #elif defined GNULIB_POSIXCHECK
825 # undef pthread_mutexattr_init
826 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT
827 _GL_WARN_ON_USE (pthread_mutexattr_init
, "pthread_mutexattr_init is not portable - "
828 "use gnulib module pthread-mutex for portability");
832 #if @GNULIB_PTHREAD_MUTEX@
833 # if @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@
834 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
835 # undef pthread_mutexattr_gettype
836 # define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype
838 _GL_FUNCDECL_RPL (pthread_mutexattr_gettype
, int,
839 (const pthread_mutexattr_t
*restrict attr
,
841 _GL_ARG_NONNULL ((1, 2)));
842 _GL_CXXALIAS_RPL (pthread_mutexattr_gettype
, int,
843 (const pthread_mutexattr_t
*restrict attr
,
844 int *restrict typep
));
846 # if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@
847 _GL_FUNCDECL_SYS (pthread_mutexattr_gettype
, int,
848 (const pthread_mutexattr_t
*restrict attr
,
850 _GL_ARG_NONNULL ((1, 2)));
852 /* Need to cast, because on FreeBSD the first parameter is
853 pthread_mutexattr_t *attr. */
854 _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype
, int,
855 (const pthread_mutexattr_t
*restrict attr
,
856 int *restrict typep
));
859 _GL_CXXALIASWARN (pthread_mutexattr_gettype
);
861 #elif defined GNULIB_POSIXCHECK
862 # undef pthread_mutexattr_gettype
863 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE
864 _GL_WARN_ON_USE (pthread_mutexattr_gettype
, "pthread_mutexattr_gettype is not portable - "
865 "use gnulib module pthread-mutex for portability");
869 #if @GNULIB_PTHREAD_MUTEX@
870 # if @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@
871 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
872 # undef pthread_mutexattr_settype
873 # define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
875 _GL_FUNCDECL_RPL (pthread_mutexattr_settype
, int,
876 (pthread_mutexattr_t
*attr
, int type
) _GL_ARG_NONNULL ((1)));
877 _GL_CXXALIAS_RPL (pthread_mutexattr_settype
, int,
878 (pthread_mutexattr_t
*attr
, int type
));
880 # if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@
881 _GL_FUNCDECL_SYS (pthread_mutexattr_settype
, int,
882 (pthread_mutexattr_t
*attr
, int type
) _GL_ARG_NONNULL ((1)));
884 _GL_CXXALIAS_SYS (pthread_mutexattr_settype
, int,
885 (pthread_mutexattr_t
*attr
, int type
));
888 _GL_CXXALIASWARN (pthread_mutexattr_settype
);
890 #elif defined GNULIB_POSIXCHECK
891 # undef pthread_mutexattr_settype
892 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE
893 _GL_WARN_ON_USE (pthread_mutexattr_settype
, "pthread_mutexattr_settype is not portable - "
894 "use gnulib module pthread-mutex for portability");
898 #if @GNULIB_PTHREAD_MUTEX@
899 # if @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@
900 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
901 # undef pthread_mutexattr_getrobust
902 # define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust
904 _GL_FUNCDECL_RPL (pthread_mutexattr_getrobust
, int,
905 (const pthread_mutexattr_t
*restrict attr
,
906 int *restrict robustp
)
907 _GL_ARG_NONNULL ((1, 2)));
908 _GL_CXXALIAS_RPL (pthread_mutexattr_getrobust
, int,
909 (const pthread_mutexattr_t
*restrict attr
,
910 int *restrict robustp
));
912 # if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@
913 _GL_FUNCDECL_SYS (pthread_mutexattr_getrobust
, int,
914 (const pthread_mutexattr_t
*restrict attr
,
915 int *restrict robustp
)
916 _GL_ARG_NONNULL ((1, 2)));
918 /* Need to cast, because on FreeBSD the first parameter is
919 pthread_mutexattr_t *attr. */
920 _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust
, int,
921 (const pthread_mutexattr_t
*restrict attr
,
922 int *restrict robustp
));
925 _GL_CXXALIASWARN (pthread_mutexattr_getrobust
);
927 #elif defined GNULIB_POSIXCHECK
928 # undef pthread_mutexattr_getrobust
929 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
930 _GL_WARN_ON_USE (pthread_mutexattr_getrobust
, "pthread_mutexattr_getrobust is not portable - "
931 "use gnulib module pthread-mutex for portability");
935 #if @GNULIB_PTHREAD_MUTEX@
936 # if @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@
937 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
938 # undef pthread_mutexattr_setrobust
939 # define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
941 _GL_FUNCDECL_RPL (pthread_mutexattr_setrobust
, int,
942 (pthread_mutexattr_t
*attr
, int robust
)
943 _GL_ARG_NONNULL ((1)));
944 _GL_CXXALIAS_RPL (pthread_mutexattr_setrobust
, int,
945 (pthread_mutexattr_t
*attr
, int robust
));
947 # if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@
948 _GL_FUNCDECL_SYS (pthread_mutexattr_setrobust
, int,
949 (pthread_mutexattr_t
*attr
, int robust
)
950 _GL_ARG_NONNULL ((1)));
952 _GL_CXXALIAS_SYS (pthread_mutexattr_setrobust
, int,
953 (pthread_mutexattr_t
*attr
, int robust
));
956 _GL_CXXALIASWARN (pthread_mutexattr_setrobust
);
958 #elif defined GNULIB_POSIXCHECK
959 # undef pthread_mutexattr_setrobust
960 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
961 _GL_WARN_ON_USE (pthread_mutexattr_setrobust
, "pthread_mutexattr_setrobust is not portable - "
962 "use gnulib module pthread-mutex for portability");
966 #if @GNULIB_PTHREAD_MUTEX@
967 # if @REPLACE_PTHREAD_MUTEXATTR_DESTROY@
968 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
969 # undef pthread_mutexattr_destroy
970 # define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
972 _GL_FUNCDECL_RPL (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
)
973 _GL_ARG_NONNULL ((1)));
974 _GL_CXXALIAS_RPL (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
));
976 # if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@
977 _GL_FUNCDECL_SYS (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
)
978 _GL_ARG_NONNULL ((1)));
980 _GL_CXXALIAS_SYS (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
));
983 _GL_CXXALIASWARN (pthread_mutexattr_destroy
);
985 #elif defined GNULIB_POSIXCHECK
986 # undef pthread_mutexattr_destroy
987 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY
988 _GL_WARN_ON_USE (pthread_mutexattr_destroy
, "pthread_mutexattr_destroy is not portable - "
989 "use gnulib module pthread-mutex for portability");
993 #if @GNULIB_PTHREAD_MUTEX@
994 # if @REPLACE_PTHREAD_MUTEX_LOCK@
995 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
996 # undef pthread_mutex_lock
997 # define pthread_mutex_lock rpl_pthread_mutex_lock
999 _GL_FUNCDECL_RPL (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
)
1000 _GL_ARG_NONNULL ((1)));
1001 _GL_CXXALIAS_RPL (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
));
1003 # if !@HAVE_PTHREAD_MUTEX_LOCK@
1004 _GL_FUNCDECL_SYS (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
)
1005 _GL_ARG_NONNULL ((1)));
1007 _GL_CXXALIAS_SYS (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
));
1010 _GL_CXXALIASWARN (pthread_mutex_lock
);
1012 #elif defined GNULIB_POSIXCHECK
1013 # undef pthread_mutex_lock
1014 # if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
1015 _GL_WARN_ON_USE (pthread_mutex_lock
, "pthread_mutex_lock is not portable - "
1016 "use gnulib module pthread-mutex for portability");
1020 #if @GNULIB_PTHREAD_MUTEX@
1021 # if @REPLACE_PTHREAD_MUTEX_TRYLOCK@
1022 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1023 # undef pthread_mutex_trylock
1024 # define pthread_mutex_trylock rpl_pthread_mutex_trylock
1026 _GL_FUNCDECL_RPL (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
)
1027 _GL_ARG_NONNULL ((1)));
1028 _GL_CXXALIAS_RPL (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
));
1030 # if !@HAVE_PTHREAD_MUTEX_TRYLOCK@
1031 _GL_FUNCDECL_SYS (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
)
1032 _GL_ARG_NONNULL ((1)));
1034 _GL_CXXALIAS_SYS (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
));
1037 _GL_CXXALIASWARN (pthread_mutex_trylock
);
1039 #elif defined GNULIB_POSIXCHECK
1040 # undef pthread_mutex_trylock
1041 # if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK
1042 _GL_WARN_ON_USE (pthread_mutex_trylock
, "pthread_mutex_trylock is not portable - "
1043 "use gnulib module pthread-mutex for portability");
1047 #if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
1048 # if @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@
1049 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1050 # undef pthread_mutex_timedlock
1051 # define pthread_mutex_timedlock rpl_pthread_mutex_timedlock
1053 _GL_FUNCDECL_RPL (pthread_mutex_timedlock
, int,
1054 (pthread_mutex_t
*restrict mutex
,
1055 const struct timespec
*restrict abstime
)
1056 _GL_ARG_NONNULL ((1, 2)));
1057 _GL_CXXALIAS_RPL (pthread_mutex_timedlock
, int,
1058 (pthread_mutex_t
*restrict mutex
,
1059 const struct timespec
*restrict abstime
));
1061 # if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@
1062 _GL_FUNCDECL_SYS (pthread_mutex_timedlock
, int,
1063 (pthread_mutex_t
*restrict mutex
,
1064 const struct timespec
*restrict abstime
)
1065 _GL_ARG_NONNULL ((1, 2)));
1067 _GL_CXXALIAS_SYS (pthread_mutex_timedlock
, int,
1068 (pthread_mutex_t
*restrict mutex
,
1069 const struct timespec
*restrict abstime
));
1072 _GL_CXXALIASWARN (pthread_mutex_timedlock
);
1074 #elif defined GNULIB_POSIXCHECK
1075 # undef pthread_mutex_timedlock
1076 # if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK
1077 _GL_WARN_ON_USE (pthread_mutex_timedlock
, "pthread_mutex_timedlock is not portable - "
1078 "use gnulib module pthread_mutex_timedlock for portability");
1082 #if @GNULIB_PTHREAD_MUTEX@
1083 # if @REPLACE_PTHREAD_MUTEX_UNLOCK@
1084 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1085 # undef pthread_mutex_unlock
1086 # define pthread_mutex_unlock rpl_pthread_mutex_unlock
1088 _GL_FUNCDECL_RPL (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
)
1089 _GL_ARG_NONNULL ((1)));
1090 _GL_CXXALIAS_RPL (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
));
1092 # if !@HAVE_PTHREAD_MUTEX_UNLOCK@
1093 _GL_FUNCDECL_SYS (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
)
1094 _GL_ARG_NONNULL ((1)));
1096 _GL_CXXALIAS_SYS (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
));
1099 _GL_CXXALIASWARN (pthread_mutex_unlock
);
1101 #elif defined GNULIB_POSIXCHECK
1102 # undef pthread_mutex_unlock
1103 # if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK
1104 _GL_WARN_ON_USE (pthread_mutex_unlock
, "pthread_mutex_unlock is not portable - "
1105 "use gnulib module pthread-mutex for portability");
1109 #if @GNULIB_PTHREAD_MUTEX@
1110 # if @REPLACE_PTHREAD_MUTEX_DESTROY@
1111 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1112 # undef pthread_mutex_destroy
1113 # define pthread_mutex_destroy rpl_pthread_mutex_destroy
1115 _GL_FUNCDECL_RPL (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
)
1116 _GL_ARG_NONNULL ((1)));
1117 _GL_CXXALIAS_RPL (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
));
1119 # if !@HAVE_PTHREAD_MUTEX_DESTROY@
1120 _GL_FUNCDECL_SYS (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
)
1121 _GL_ARG_NONNULL ((1)));
1123 _GL_CXXALIAS_SYS (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
));
1126 _GL_CXXALIASWARN (pthread_mutex_destroy
);
1128 #elif defined GNULIB_POSIXCHECK
1129 # undef pthread_mutex_destroy
1130 # if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY
1131 _GL_WARN_ON_USE (pthread_mutex_destroy
, "pthread_mutex_destroy is not portable - "
1132 "use gnulib module pthread-mutex for portability");
1136 /* =========== Read-write lock functions =========== */
1138 #if @GNULIB_PTHREAD_RWLOCK@
1139 # if @REPLACE_PTHREAD_RWLOCK_INIT@
1140 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1141 # undef pthread_rwlock_init
1142 # define pthread_rwlock_init rpl_pthread_rwlock_init
1144 _GL_FUNCDECL_RPL (pthread_rwlock_init
, int,
1145 (pthread_rwlock_t
*restrict lock
,
1146 const pthread_rwlockattr_t
*restrict attr
)
1147 _GL_ARG_NONNULL ((1)));
1148 _GL_CXXALIAS_RPL (pthread_rwlock_init
, int,
1149 (pthread_rwlock_t
*restrict lock
,
1150 const pthread_rwlockattr_t
*restrict attr
));
1152 # if !@HAVE_PTHREAD_RWLOCK_INIT@
1153 _GL_FUNCDECL_SYS (pthread_rwlock_init
, int,
1154 (pthread_rwlock_t
*restrict lock
,
1155 const pthread_rwlockattr_t
*restrict attr
)
1156 _GL_ARG_NONNULL ((1)));
1158 _GL_CXXALIAS_SYS (pthread_rwlock_init
, int,
1159 (pthread_rwlock_t
*restrict lock
,
1160 const pthread_rwlockattr_t
*restrict attr
));
1163 _GL_CXXALIASWARN (pthread_rwlock_init
);
1165 #elif defined GNULIB_POSIXCHECK
1166 # undef pthread_rwlock_init
1167 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT
1168 _GL_WARN_ON_USE (pthread_rwlock_init
, "pthread_rwlock_init is not portable - "
1169 "use gnulib module pthread-rwlock for portability");
1173 #if @GNULIB_PTHREAD_RWLOCK@
1174 # if @REPLACE_PTHREAD_RWLOCKATTR_INIT@
1175 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1176 # undef pthread_rwlockattr_init
1177 # define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
1179 _GL_FUNCDECL_RPL (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
)
1180 _GL_ARG_NONNULL ((1)));
1181 _GL_CXXALIAS_RPL (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
));
1183 # if !@HAVE_PTHREAD_RWLOCKATTR_INIT@
1184 _GL_FUNCDECL_SYS (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
)
1185 _GL_ARG_NONNULL ((1)));
1187 _GL_CXXALIAS_SYS (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
));
1190 _GL_CXXALIASWARN (pthread_rwlockattr_init
);
1192 #elif defined GNULIB_POSIXCHECK
1193 # undef pthread_rwlockattr_init
1194 # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT
1195 _GL_WARN_ON_USE (pthread_rwlockattr_init
, "pthread_rwlockattr_init is not portable - "
1196 "use gnulib module pthread-rwlock for portability");
1200 #if @GNULIB_PTHREAD_RWLOCK@
1201 # if @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@
1202 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1203 # undef pthread_rwlockattr_destroy
1204 # define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
1206 _GL_FUNCDECL_RPL (pthread_rwlockattr_destroy
, int,
1207 (pthread_rwlockattr_t
*attr
) _GL_ARG_NONNULL ((1)));
1208 _GL_CXXALIAS_RPL (pthread_rwlockattr_destroy
, int,
1209 (pthread_rwlockattr_t
*attr
));
1211 # if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@
1212 _GL_FUNCDECL_SYS (pthread_rwlockattr_destroy
, int,
1213 (pthread_rwlockattr_t
*attr
) _GL_ARG_NONNULL ((1)));
1215 _GL_CXXALIAS_SYS (pthread_rwlockattr_destroy
, int,
1216 (pthread_rwlockattr_t
*attr
));
1219 _GL_CXXALIASWARN (pthread_rwlockattr_destroy
);
1221 #elif defined GNULIB_POSIXCHECK
1222 # undef pthread_rwlockattr_destroy
1223 # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY
1224 _GL_WARN_ON_USE (pthread_rwlockattr_destroy
, "pthread_rwlockattr_destroy is not portable - "
1225 "use gnulib module pthread-rwlock for portability");
1229 #if @GNULIB_PTHREAD_RWLOCK@
1230 # if @REPLACE_PTHREAD_RWLOCK_RDLOCK@
1231 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1232 # undef pthread_rwlock_rdlock
1233 # define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
1235 _GL_FUNCDECL_RPL (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
)
1236 _GL_ARG_NONNULL ((1)));
1237 _GL_CXXALIAS_RPL (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
));
1239 # if !@HAVE_PTHREAD_RWLOCK_RDLOCK@
1240 _GL_FUNCDECL_SYS (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
)
1241 _GL_ARG_NONNULL ((1)));
1243 _GL_CXXALIAS_SYS (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
));
1246 _GL_CXXALIASWARN (pthread_rwlock_rdlock
);
1248 #elif defined GNULIB_POSIXCHECK
1249 # undef pthread_rwlock_rdlock
1250 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK
1251 _GL_WARN_ON_USE (pthread_rwlock_rdlock
, "pthread_rwlock_rdlock is not portable - "
1252 "use gnulib module pthread-rwlock for portability");
1256 #if @GNULIB_PTHREAD_RWLOCK@
1257 # if @REPLACE_PTHREAD_RWLOCK_WRLOCK@
1258 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1259 # undef pthread_rwlock_wrlock
1260 # define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
1262 _GL_FUNCDECL_RPL (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
)
1263 _GL_ARG_NONNULL ((1)));
1264 _GL_CXXALIAS_RPL (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
));
1266 # if !@HAVE_PTHREAD_RWLOCK_WRLOCK@
1267 _GL_FUNCDECL_SYS (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
)
1268 _GL_ARG_NONNULL ((1)));
1270 _GL_CXXALIAS_SYS (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
));
1273 _GL_CXXALIASWARN (pthread_rwlock_wrlock
);
1275 #elif defined GNULIB_POSIXCHECK
1276 # undef pthread_rwlock_wrlock
1277 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK
1278 _GL_WARN_ON_USE (pthread_rwlock_wrlock
, "pthread_rwlock_wrlock is not portable - "
1279 "use gnulib module pthread-rwlock for portability");
1283 #if @GNULIB_PTHREAD_RWLOCK@
1284 # if @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@
1285 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1286 # undef pthread_rwlock_tryrdlock
1287 # define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
1289 _GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
)
1290 _GL_ARG_NONNULL ((1)));
1291 _GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
));
1293 # if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
1294 _GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
)
1295 _GL_ARG_NONNULL ((1)));
1297 _GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
));
1300 _GL_CXXALIASWARN (pthread_rwlock_tryrdlock
);
1302 #elif defined GNULIB_POSIXCHECK
1303 # undef pthread_rwlock_tryrdlock
1304 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK
1305 _GL_WARN_ON_USE (pthread_rwlock_tryrdlock
, "pthread_rwlock_tryrdlock is not portable - "
1306 "use gnulib module pthread-rwlock for portability");
1310 #if @GNULIB_PTHREAD_RWLOCK@
1311 # if @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@
1312 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1313 # undef pthread_rwlock_trywrlock
1314 # define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
1316 _GL_FUNCDECL_RPL (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
)
1317 _GL_ARG_NONNULL ((1)));
1318 _GL_CXXALIAS_RPL (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
));
1320 # if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
1321 _GL_FUNCDECL_SYS (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
)
1322 _GL_ARG_NONNULL ((1)));
1324 _GL_CXXALIAS_SYS (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
));
1327 _GL_CXXALIASWARN (pthread_rwlock_trywrlock
);
1329 #elif defined GNULIB_POSIXCHECK
1330 # undef pthread_rwlock_trywrlock
1331 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK
1332 _GL_WARN_ON_USE (pthread_rwlock_trywrlock
, "pthread_rwlock_trywrlock is not portable - "
1333 "use gnulib module pthread-rwlock for portability");
1337 #if @GNULIB_PTHREAD_RWLOCK@
1338 # if @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1339 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1340 # undef pthread_rwlock_timedrdlock
1341 # define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock
1343 _GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock
, int,
1344 (pthread_rwlock_t
*restrict lock
,
1345 const struct timespec
*restrict abstime
)
1346 _GL_ARG_NONNULL ((1, 2)));
1347 _GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock
, int,
1348 (pthread_rwlock_t
*restrict lock
,
1349 const struct timespec
*restrict abstime
));
1351 # if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1352 _GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock
, int,
1353 (pthread_rwlock_t
*restrict lock
,
1354 const struct timespec
*restrict abstime
)
1355 _GL_ARG_NONNULL ((1, 2)));
1357 _GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock
, int,
1358 (pthread_rwlock_t
*restrict lock
,
1359 const struct timespec
*restrict abstime
));
1362 _GL_CXXALIASWARN (pthread_rwlock_timedrdlock
);
1364 #elif defined GNULIB_POSIXCHECK
1365 # undef pthread_rwlock_timedrdlock
1366 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK
1367 _GL_WARN_ON_USE (pthread_rwlock_timedrdlock
, "pthread_rwlock_timedrdlock is not portable - "
1368 "use gnulib module pthread-rwlock for portability");
1372 #if @GNULIB_PTHREAD_RWLOCK@
1373 # if @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1374 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1375 # undef pthread_rwlock_timedwrlock
1376 # define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock
1378 _GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock
, 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_timedwrlock
, int,
1383 (pthread_rwlock_t
*restrict lock
,
1384 const struct timespec
*restrict abstime
));
1386 # if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1387 _GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock
, 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_timedwrlock
, int,
1393 (pthread_rwlock_t
*restrict lock
,
1394 const struct timespec
*restrict abstime
));
1397 _GL_CXXALIASWARN (pthread_rwlock_timedwrlock
);
1399 #elif defined GNULIB_POSIXCHECK
1400 # undef pthread_rwlock_timedwrlock
1401 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK
1402 _GL_WARN_ON_USE (pthread_rwlock_timedwrlock
, "pthread_rwlock_timedwrlock is not portable - "
1403 "use gnulib module pthread-rwlock for portability");
1407 #if @GNULIB_PTHREAD_RWLOCK@
1408 # if @REPLACE_PTHREAD_RWLOCK_UNLOCK@
1409 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1410 # undef pthread_rwlock_unlock
1411 # define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
1413 _GL_FUNCDECL_RPL (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
)
1414 _GL_ARG_NONNULL ((1)));
1415 _GL_CXXALIAS_RPL (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
));
1417 # if !@HAVE_PTHREAD_RWLOCK_UNLOCK@
1418 _GL_FUNCDECL_SYS (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
)
1419 _GL_ARG_NONNULL ((1)));
1421 _GL_CXXALIAS_SYS (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
));
1424 _GL_CXXALIASWARN (pthread_rwlock_unlock
);
1426 #elif defined GNULIB_POSIXCHECK
1427 # undef pthread_rwlock_unlock
1428 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK
1429 _GL_WARN_ON_USE (pthread_rwlock_unlock
, "pthread_rwlock_unlock is not portable - "
1430 "use gnulib module pthread-rwlock for portability");
1434 #if @GNULIB_PTHREAD_RWLOCK@
1435 # if @REPLACE_PTHREAD_RWLOCK_DESTROY@
1436 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1437 # undef pthread_rwlock_destroy
1438 # define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
1440 _GL_FUNCDECL_RPL (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
)
1441 _GL_ARG_NONNULL ((1)));
1442 _GL_CXXALIAS_RPL (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
));
1444 # if !@HAVE_PTHREAD_RWLOCK_DESTROY@
1445 _GL_FUNCDECL_SYS (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
)
1446 _GL_ARG_NONNULL ((1)));
1448 _GL_CXXALIAS_SYS (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
));
1451 _GL_CXXALIASWARN (pthread_rwlock_destroy
);
1453 #elif defined GNULIB_POSIXCHECK
1454 # undef pthread_rwlock_destroy
1455 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY
1456 _GL_WARN_ON_USE (pthread_rwlock_destroy
, "pthread_rwlock_destroy is not portable - "
1457 "use gnulib module pthread-rwlock for portability");
1461 /* =========== Condition variable functions =========== */
1463 #if @GNULIB_PTHREAD_COND@
1464 # if @REPLACE_PTHREAD_COND_INIT@
1465 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1466 # undef pthread_cond_init
1467 # define pthread_cond_init rpl_pthread_cond_init
1469 _GL_FUNCDECL_RPL (pthread_cond_init
, int,
1470 (pthread_cond_t
*restrict cond
,
1471 const pthread_condattr_t
*restrict attr
)
1472 _GL_ARG_NONNULL ((1)));
1473 _GL_CXXALIAS_RPL (pthread_cond_init
, int,
1474 (pthread_cond_t
*restrict cond
,
1475 const pthread_condattr_t
*restrict attr
));
1477 # if !@HAVE_PTHREAD_COND_INIT@
1478 _GL_FUNCDECL_SYS (pthread_cond_init
, int,
1479 (pthread_cond_t
*restrict cond
,
1480 const pthread_condattr_t
*restrict attr
)
1481 _GL_ARG_NONNULL ((1)));
1483 _GL_CXXALIAS_SYS (pthread_cond_init
, int,
1484 (pthread_cond_t
*restrict cond
,
1485 const pthread_condattr_t
*restrict attr
));
1488 _GL_CXXALIASWARN (pthread_cond_init
);
1490 #elif defined GNULIB_POSIXCHECK
1491 # undef pthread_cond_init
1492 # if HAVE_RAW_DECL_PTHREAD_COND_INIT
1493 _GL_WARN_ON_USE (pthread_cond_init
, "pthread_cond_init is not portable - "
1494 "use gnulib module pthread-cond for portability");
1498 #if @GNULIB_PTHREAD_COND@
1499 # if @REPLACE_PTHREAD_CONDATTR_INIT@
1500 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1501 # undef pthread_condattr_init
1502 # define pthread_condattr_init rpl_pthread_condattr_init
1504 _GL_FUNCDECL_RPL (pthread_condattr_init
, int, (pthread_condattr_t
*attr
)
1505 _GL_ARG_NONNULL ((1)));
1506 _GL_CXXALIAS_RPL (pthread_condattr_init
, int, (pthread_condattr_t
*attr
));
1508 # if !@HAVE_PTHREAD_CONDATTR_INIT@
1509 _GL_FUNCDECL_SYS (pthread_condattr_init
, int, (pthread_condattr_t
*attr
)
1510 _GL_ARG_NONNULL ((1)));
1512 _GL_CXXALIAS_SYS (pthread_condattr_init
, int, (pthread_condattr_t
*attr
));
1515 _GL_CXXALIASWARN (pthread_condattr_init
);
1517 #elif defined GNULIB_POSIXCHECK
1518 # undef pthread_condattr_init
1519 # if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT
1520 _GL_WARN_ON_USE (pthread_condattr_init
, "pthread_condattr_init is not portable - "
1521 "use gnulib module pthread-cond for portability");
1525 #if @GNULIB_PTHREAD_COND@
1526 # if @REPLACE_PTHREAD_CONDATTR_DESTROY@
1527 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1528 # undef pthread_condattr_destroy
1529 # define pthread_condattr_destroy rpl_pthread_condattr_destroy
1531 _GL_FUNCDECL_RPL (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
)
1532 _GL_ARG_NONNULL ((1)));
1533 _GL_CXXALIAS_RPL (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
));
1535 # if !@HAVE_PTHREAD_CONDATTR_DESTROY@
1536 _GL_FUNCDECL_SYS (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
)
1537 _GL_ARG_NONNULL ((1)));
1539 _GL_CXXALIAS_SYS (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
));
1542 _GL_CXXALIASWARN (pthread_condattr_destroy
);
1544 #elif defined GNULIB_POSIXCHECK
1545 # undef pthread_condattr_destroy
1546 # if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY
1547 _GL_WARN_ON_USE (pthread_condattr_destroy
, "pthread_condattr_destroy is not portable - "
1548 "use gnulib module pthread-cond for portability");
1552 #if @GNULIB_PTHREAD_COND@
1553 # if @REPLACE_PTHREAD_COND_WAIT@
1554 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1555 # undef pthread_cond_wait
1556 # define pthread_cond_wait rpl_pthread_cond_wait
1558 _GL_FUNCDECL_RPL (pthread_cond_wait
, int,
1559 (pthread_cond_t
*restrict cond
,
1560 pthread_mutex_t
*restrict mutex
)
1561 _GL_ARG_NONNULL ((1, 2)));
1562 _GL_CXXALIAS_RPL (pthread_cond_wait
, int,
1563 (pthread_cond_t
*restrict cond
,
1564 pthread_mutex_t
*restrict mutex
));
1566 # if !@HAVE_PTHREAD_COND_WAIT@
1567 _GL_FUNCDECL_SYS (pthread_cond_wait
, int,
1568 (pthread_cond_t
*restrict cond
,
1569 pthread_mutex_t
*restrict mutex
)
1570 _GL_ARG_NONNULL ((1, 2)));
1572 _GL_CXXALIAS_SYS (pthread_cond_wait
, int,
1573 (pthread_cond_t
*restrict cond
,
1574 pthread_mutex_t
*restrict mutex
));
1577 _GL_CXXALIASWARN (pthread_cond_wait
);
1579 #elif defined GNULIB_POSIXCHECK
1580 # undef pthread_cond_wait
1581 # if HAVE_RAW_DECL_PTHREAD_COND_WAIT
1582 _GL_WARN_ON_USE (pthread_cond_wait
, "pthread_cond_wait is not portable - "
1583 "use gnulib module pthread-cond for portability");
1587 #if @GNULIB_PTHREAD_COND@
1588 # if @REPLACE_PTHREAD_COND_TIMEDWAIT@
1589 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1590 # undef pthread_cond_timedwait
1591 # define pthread_cond_timedwait rpl_pthread_cond_timedwait
1593 _GL_FUNCDECL_RPL (pthread_cond_timedwait
, int,
1594 (pthread_cond_t
*restrict cond
,
1595 pthread_mutex_t
*restrict mutex
,
1596 const struct timespec
*restrict abstime
)
1597 _GL_ARG_NONNULL ((1, 2, 3)));
1598 _GL_CXXALIAS_RPL (pthread_cond_timedwait
, int,
1599 (pthread_cond_t
*restrict cond
,
1600 pthread_mutex_t
*restrict mutex
,
1601 const struct timespec
*restrict abstime
));
1603 # if !@HAVE_PTHREAD_COND_TIMEDWAIT@
1604 _GL_FUNCDECL_SYS (pthread_cond_timedwait
, int,
1605 (pthread_cond_t
*restrict cond
,
1606 pthread_mutex_t
*restrict mutex
,
1607 const struct timespec
*restrict abstime
)
1608 _GL_ARG_NONNULL ((1, 2, 3)));
1610 _GL_CXXALIAS_SYS (pthread_cond_timedwait
, int,
1611 (pthread_cond_t
*restrict cond
,
1612 pthread_mutex_t
*restrict mutex
,
1613 const struct timespec
*restrict abstime
));
1616 _GL_CXXALIASWARN (pthread_cond_timedwait
);
1618 #elif defined GNULIB_POSIXCHECK
1619 # undef pthread_cond_timedwait
1620 # if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT
1621 _GL_WARN_ON_USE (pthread_cond_timedwait
, "pthread_cond_timedwait is not portable - "
1622 "use gnulib module pthread-cond for portability");
1626 #if @GNULIB_PTHREAD_COND@
1627 # if @REPLACE_PTHREAD_COND_SIGNAL@
1628 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1629 # undef pthread_cond_signal
1630 # define pthread_cond_signal rpl_pthread_cond_signal
1632 _GL_FUNCDECL_RPL (pthread_cond_signal
, int, (pthread_cond_t
*cond
)
1633 _GL_ARG_NONNULL ((1)));
1634 _GL_CXXALIAS_RPL (pthread_cond_signal
, int, (pthread_cond_t
*cond
));
1636 # if !@HAVE_PTHREAD_COND_SIGNAL@
1637 _GL_FUNCDECL_SYS (pthread_cond_signal
, int, (pthread_cond_t
*cond
)
1638 _GL_ARG_NONNULL ((1)));
1640 _GL_CXXALIAS_SYS (pthread_cond_signal
, int, (pthread_cond_t
*cond
));
1643 _GL_CXXALIASWARN (pthread_cond_signal
);
1645 #elif defined GNULIB_POSIXCHECK
1646 # undef pthread_cond_signal
1647 # if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL
1648 _GL_WARN_ON_USE (pthread_cond_signal
, "pthread_cond_signal is not portable - "
1649 "use gnulib module pthread-cond for portability");
1653 #if @GNULIB_PTHREAD_COND@
1654 # if @REPLACE_PTHREAD_COND_BROADCAST@
1655 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1656 # undef pthread_cond_broadcast
1657 # define pthread_cond_broadcast rpl_pthread_cond_broadcast
1659 _GL_FUNCDECL_RPL (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
)
1660 _GL_ARG_NONNULL ((1)));
1661 _GL_CXXALIAS_RPL (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
));
1663 # if !@HAVE_PTHREAD_COND_BROADCAST@
1664 _GL_FUNCDECL_SYS (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
)
1665 _GL_ARG_NONNULL ((1)));
1667 _GL_CXXALIAS_SYS (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
));
1670 _GL_CXXALIASWARN (pthread_cond_broadcast
);
1672 #elif defined GNULIB_POSIXCHECK
1673 # undef pthread_cond_broadcast
1674 # if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST
1675 _GL_WARN_ON_USE (pthread_cond_broadcast
, "pthread_cond_broadcast is not portable - "
1676 "use gnulib module pthread-cond for portability");
1680 #if @GNULIB_PTHREAD_COND@
1681 # if @REPLACE_PTHREAD_COND_DESTROY@
1682 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1683 # undef pthread_cond_destroy
1684 # define pthread_cond_destroy rpl_pthread_cond_destroy
1686 _GL_FUNCDECL_RPL (pthread_cond_destroy
, int, (pthread_cond_t
*cond
)
1687 _GL_ARG_NONNULL ((1)));
1688 _GL_CXXALIAS_RPL (pthread_cond_destroy
, int, (pthread_cond_t
*cond
));
1690 # if !@HAVE_PTHREAD_COND_DESTROY@
1691 _GL_FUNCDECL_SYS (pthread_cond_destroy
, int, (pthread_cond_t
*cond
)
1692 _GL_ARG_NONNULL ((1)));
1694 _GL_CXXALIAS_SYS (pthread_cond_destroy
, int, (pthread_cond_t
*cond
));
1697 _GL_CXXALIASWARN (pthread_cond_destroy
);
1699 #elif defined GNULIB_POSIXCHECK
1700 # undef pthread_cond_destroy
1701 # if HAVE_RAW_DECL_PTHREAD_COND_DESTROY
1702 _GL_WARN_ON_USE (pthread_cond_destroy
, "pthread_cond_destroy is not portable - "
1703 "use gnulib module pthread-cond for portability");
1707 /* =========== Thread-specific storage functions =========== */
1709 #if @GNULIB_PTHREAD_TSS@
1710 # if @REPLACE_PTHREAD_KEY_CREATE@
1711 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1712 # undef pthread_key_create
1713 # define pthread_key_create rpl_pthread_key_create
1715 _GL_FUNCDECL_RPL (pthread_key_create
, int,
1716 (pthread_key_t
*keyp
, void (*destructor
) (void *))
1717 _GL_ARG_NONNULL ((1)));
1718 _GL_CXXALIAS_RPL (pthread_key_create
, int,
1719 (pthread_key_t
*keyp
, void (*destructor
) (void *)));
1721 # if !@HAVE_PTHREAD_KEY_CREATE@
1722 _GL_FUNCDECL_SYS (pthread_key_create
, int,
1723 (pthread_key_t
*keyp
, void (*destructor
) (void *))
1724 _GL_ARG_NONNULL ((1)));
1726 _GL_CXXALIAS_SYS_CAST (pthread_key_create
, int,
1727 (pthread_key_t
*keyp
, void (*destructor
) (void *)));
1730 _GL_CXXALIASWARN (pthread_key_create
);
1732 #elif defined GNULIB_POSIXCHECK
1733 # undef pthread_key_create
1734 # if HAVE_RAW_DECL_PTHREAD_KEY_CREATE
1735 _GL_WARN_ON_USE (pthread_key_create
, "pthread_key_create is not portable - "
1736 "use gnulib module pthread-tss for portability");
1740 #if @GNULIB_PTHREAD_TSS@
1741 # if @REPLACE_PTHREAD_SETSPECIFIC@
1742 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1743 # undef pthread_setspecific
1744 # define pthread_setspecific rpl_pthread_setspecific
1746 _GL_FUNCDECL_RPL (pthread_setspecific
, int,
1747 (pthread_key_t key
, const void *value
));
1748 _GL_CXXALIAS_RPL (pthread_setspecific
, int,
1749 (pthread_key_t key
, const void *value
));
1751 # if !@HAVE_PTHREAD_SETSPECIFIC@
1752 _GL_FUNCDECL_SYS (pthread_setspecific
, int,
1753 (pthread_key_t key
, const void *value
));
1755 _GL_CXXALIAS_SYS (pthread_setspecific
, int,
1756 (pthread_key_t key
, const void *value
));
1759 _GL_CXXALIASWARN (pthread_setspecific
);
1761 #elif defined GNULIB_POSIXCHECK
1762 # undef pthread_setspecific
1763 # if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC
1764 _GL_WARN_ON_USE (pthread_setspecific
, "pthread_setspecific is not portable - "
1765 "use gnulib module pthread-tss for portability");
1769 #if @GNULIB_PTHREAD_TSS@
1770 # if @REPLACE_PTHREAD_GETSPECIFIC@
1771 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1772 # undef pthread_getspecific
1773 # define pthread_getspecific rpl_pthread_getspecific
1775 _GL_FUNCDECL_RPL (pthread_getspecific
, void *, (pthread_key_t key
));
1776 _GL_CXXALIAS_RPL (pthread_getspecific
, void *, (pthread_key_t key
));
1778 # if !@HAVE_PTHREAD_GETSPECIFIC@
1779 _GL_FUNCDECL_SYS (pthread_getspecific
, void *, (pthread_key_t key
));
1781 _GL_CXXALIAS_SYS (pthread_getspecific
, void *, (pthread_key_t key
));
1784 _GL_CXXALIASWARN (pthread_getspecific
);
1786 #elif defined GNULIB_POSIXCHECK
1787 # undef pthread_getspecific
1788 # if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC
1789 _GL_WARN_ON_USE (pthread_getspecific
, "pthread_getspecific is not portable - "
1790 "use gnulib module pthread-tss for portability");
1794 #if @GNULIB_PTHREAD_TSS@
1795 # if @REPLACE_PTHREAD_KEY_DELETE@
1796 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1797 # undef pthread_key_delete
1798 # define pthread_key_delete rpl_pthread_key_delete
1800 _GL_FUNCDECL_RPL (pthread_key_delete
, int, (pthread_key_t key
));
1801 _GL_CXXALIAS_RPL (pthread_key_delete
, int, (pthread_key_t key
));
1803 # if !@HAVE_PTHREAD_KEY_DELETE@
1804 _GL_FUNCDECL_SYS (pthread_key_delete
, int, (pthread_key_t key
));
1806 _GL_CXXALIAS_SYS (pthread_key_delete
, int, (pthread_key_t key
));
1809 _GL_CXXALIASWARN (pthread_key_delete
);
1811 #elif defined GNULIB_POSIXCHECK
1812 # undef pthread_key_delete
1813 # if HAVE_RAW_DECL_PTHREAD_KEY_DELETE
1814 _GL_WARN_ON_USE (pthread_key_delete
, "pthread_key_delete is not portable - "
1815 "use gnulib module pthread-tss for portability");
1819 /* =========== Spinlock functions =========== */
1821 #if @GNULIB_PTHREAD_SPIN@
1822 # if @REPLACE_PTHREAD_SPIN_INIT@
1823 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1824 # undef pthread_spin_init
1825 # define pthread_spin_init rpl_pthread_spin_init
1827 _GL_FUNCDECL_RPL (pthread_spin_init
, int,
1828 (pthread_spinlock_t
*lock
, int shared_across_processes
)
1829 _GL_ARG_NONNULL ((1)));
1830 _GL_CXXALIAS_RPL (pthread_spin_init
, int,
1831 (pthread_spinlock_t
*lock
, int shared_across_processes
));
1833 # if !@HAVE_PTHREAD_SPIN_INIT@
1834 _GL_FUNCDECL_SYS (pthread_spin_init
, int,
1835 (pthread_spinlock_t
*lock
, int shared_across_processes
)
1836 _GL_ARG_NONNULL ((1)));
1838 _GL_CXXALIAS_SYS (pthread_spin_init
, int,
1839 (pthread_spinlock_t
*lock
, int shared_across_processes
));
1842 _GL_CXXALIASWARN (pthread_spin_init
);
1844 #elif defined GNULIB_POSIXCHECK
1845 # undef pthread_spin_init
1846 # if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
1847 _GL_WARN_ON_USE (pthread_spin_init
, "pthread_spin_init is not portable - "
1848 "use gnulib module pthread-spin for portability");
1852 #if @GNULIB_PTHREAD_SPIN@
1853 # if @REPLACE_PTHREAD_SPIN_LOCK@
1854 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1855 # undef pthread_spin_lock
1856 # define pthread_spin_lock rpl_pthread_spin_lock
1858 _GL_FUNCDECL_RPL (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
)
1859 _GL_ARG_NONNULL ((1)));
1860 _GL_CXXALIAS_RPL (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
));
1862 # if !@HAVE_PTHREAD_SPIN_LOCK@
1863 _GL_FUNCDECL_SYS (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
)
1864 _GL_ARG_NONNULL ((1)));
1866 _GL_CXXALIAS_SYS (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
));
1869 _GL_CXXALIASWARN (pthread_spin_lock
);
1871 #elif defined GNULIB_POSIXCHECK
1872 # undef pthread_spin_lock
1873 # if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
1874 _GL_WARN_ON_USE (pthread_spin_lock
, "pthread_spin_lock is not portable - "
1875 "use gnulib module pthread-spin for portability");
1879 #if @GNULIB_PTHREAD_SPIN@
1880 # if @REPLACE_PTHREAD_SPIN_TRYLOCK@
1881 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1882 # undef pthread_spin_trylock
1883 # define pthread_spin_trylock rpl_pthread_spin_trylock
1885 _GL_FUNCDECL_RPL (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
)
1886 _GL_ARG_NONNULL ((1)));
1887 _GL_CXXALIAS_RPL (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
));
1889 # if !@HAVE_PTHREAD_SPIN_TRYLOCK@
1890 _GL_FUNCDECL_SYS (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
)
1891 _GL_ARG_NONNULL ((1)));
1893 _GL_CXXALIAS_SYS (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
));
1896 _GL_CXXALIASWARN (pthread_spin_trylock
);
1898 #elif defined GNULIB_POSIXCHECK
1899 # undef pthread_spin_trylock
1900 # if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
1901 _GL_WARN_ON_USE (pthread_spin_trylock
, "pthread_spin_trylock is not portable - "
1902 "use gnulib module pthread-spin for portability");
1906 #if @GNULIB_PTHREAD_SPIN@
1907 # if @REPLACE_PTHREAD_SPIN_UNLOCK@
1908 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1909 # undef pthread_spin_unlock
1910 # define pthread_spin_unlock rpl_pthread_spin_unlock
1912 _GL_FUNCDECL_RPL (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
)
1913 _GL_ARG_NONNULL ((1)));
1914 _GL_CXXALIAS_RPL (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
));
1916 # if !@HAVE_PTHREAD_SPIN_UNLOCK@
1917 _GL_FUNCDECL_SYS (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
)
1918 _GL_ARG_NONNULL ((1)));
1920 _GL_CXXALIAS_SYS (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
));
1923 _GL_CXXALIASWARN (pthread_spin_unlock
);
1925 #elif defined GNULIB_POSIXCHECK
1926 # undef pthread_spin_unlock
1927 # if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
1928 _GL_WARN_ON_USE (pthread_spin_unlock
, "pthread_spin_unlock is not portable - "
1929 "use gnulib module pthread-spin for portability");
1933 #if @GNULIB_PTHREAD_SPIN@
1934 # if @REPLACE_PTHREAD_SPIN_DESTROY@
1935 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1936 # undef pthread_spin_destroy
1937 # define pthread_spin_destroy rpl_pthread_spin_destroy
1939 _GL_FUNCDECL_RPL (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
)
1940 _GL_ARG_NONNULL ((1)));
1941 _GL_CXXALIAS_RPL (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
));
1943 # if !@HAVE_PTHREAD_SPIN_DESTROY@
1944 _GL_FUNCDECL_SYS (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
)
1945 _GL_ARG_NONNULL ((1)));
1947 _GL_CXXALIAS_SYS (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
));
1950 _GL_CXXALIASWARN (pthread_spin_destroy
);
1952 #elif defined GNULIB_POSIXCHECK
1953 # undef pthread_spin_destroy
1954 # if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
1955 _GL_WARN_ON_USE (pthread_spin_destroy
, "pthread_spin_destroy is not portable - "
1956 "use gnulib module pthread-spin for portability");
1961 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
1962 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */