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
));
481 _GL_CXXALIASWARN (pthread_create
);
482 #elif defined GNULIB_POSIXCHECK
483 # undef pthread_create
484 # if HAVE_RAW_DECL_PTHREAD_CREATE
485 _GL_WARN_ON_USE (pthread_create
, "pthread_create is not portable - "
486 "use gnulib module pthread-thread for portability");
490 #if @GNULIB_PTHREAD_THREAD@
491 # if @REPLACE_PTHREAD_ATTR_INIT@
492 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
493 # undef pthread_attr_init
494 # define pthread_attr_init rpl_pthread_attr_init
496 _GL_FUNCDECL_RPL (pthread_attr_init
, int, (pthread_attr_t
*attr
)
497 _GL_ARG_NONNULL ((1)));
498 _GL_CXXALIAS_RPL (pthread_attr_init
, int, (pthread_attr_t
*attr
));
500 # if !@HAVE_PTHREAD_ATTR_INIT@
501 _GL_FUNCDECL_SYS (pthread_attr_init
, int, (pthread_attr_t
*attr
)
502 _GL_ARG_NONNULL ((1)));
504 _GL_CXXALIAS_SYS (pthread_attr_init
, int, (pthread_attr_t
*attr
));
506 _GL_CXXALIASWARN (pthread_attr_init
);
507 #elif defined GNULIB_POSIXCHECK
508 # undef pthread_attr_init
509 # if HAVE_RAW_DECL_PTHREAD_ATTR_INIT
510 _GL_WARN_ON_USE (pthread_attr_init
, "pthread_attr_init is not portable - "
511 "use gnulib module pthread-thread for portability");
515 #if @GNULIB_PTHREAD_THREAD@
516 # if @REPLACE_PTHREAD_ATTR_GETDETACHSTATE@
517 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
518 # undef pthread_attr_getdetachstate
519 # define pthread_attr_getdetachstate rpl_pthread_attr_getdetachstate
521 _GL_FUNCDECL_RPL (pthread_attr_getdetachstate
, int,
522 (const pthread_attr_t
*attr
, int *detachstatep
)
523 _GL_ARG_NONNULL ((1, 2)));
524 _GL_CXXALIAS_RPL (pthread_attr_getdetachstate
, int,
525 (const pthread_attr_t
*attr
, int *detachstatep
));
527 # if !@HAVE_PTHREAD_ATTR_GETDETACHSTATE@
528 _GL_FUNCDECL_SYS (pthread_attr_getdetachstate
, int,
529 (const pthread_attr_t
*attr
, int *detachstatep
)
530 _GL_ARG_NONNULL ((1, 2)));
532 _GL_CXXALIAS_SYS (pthread_attr_getdetachstate
, int,
533 (const pthread_attr_t
*attr
, int *detachstatep
));
535 _GL_CXXALIASWARN (pthread_attr_getdetachstate
);
536 #elif defined GNULIB_POSIXCHECK
537 # undef pthread_attr_getdetachstate
538 # if HAVE_RAW_DECL_PTHREAD_ATTR_GETDETACHSTATE
539 _GL_WARN_ON_USE (pthread_attr_getdetachstate
, "pthread_attr_getdetachstate is not portable - "
540 "use gnulib module pthread-thread for portability");
544 #if @GNULIB_PTHREAD_THREAD@
545 # if @REPLACE_PTHREAD_ATTR_SETDETACHSTATE@
546 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
547 # undef pthread_attr_setdetachstate
548 # define pthread_attr_setdetachstate rpl_pthread_attr_setdetachstate
550 _GL_FUNCDECL_RPL (pthread_attr_setdetachstate
, int,
551 (pthread_attr_t
*attr
, int detachstate
)
552 _GL_ARG_NONNULL ((1)));
553 _GL_CXXALIAS_RPL (pthread_attr_setdetachstate
, int,
554 (pthread_attr_t
*attr
, int detachstate
));
556 # if !@HAVE_PTHREAD_ATTR_SETDETACHSTATE@
557 _GL_FUNCDECL_SYS (pthread_attr_setdetachstate
, int,
558 (pthread_attr_t
*attr
, int detachstate
)
559 _GL_ARG_NONNULL ((1)));
561 _GL_CXXALIAS_SYS (pthread_attr_setdetachstate
, int,
562 (pthread_attr_t
*attr
, int detachstate
));
564 _GL_CXXALIASWARN (pthread_attr_setdetachstate
);
565 #elif defined GNULIB_POSIXCHECK
566 # undef pthread_attr_setdetachstate
567 # if HAVE_RAW_DECL_PTHREAD_ATTR_SETDETACHSTATE
568 _GL_WARN_ON_USE (pthread_attr_setdetachstate
, "pthread_attr_setdetachstate is not portable - "
569 "use gnulib module pthread-thread for portability");
573 #if @GNULIB_PTHREAD_THREAD@
574 # if @REPLACE_PTHREAD_ATTR_DESTROY@
575 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
576 # undef pthread_attr_destroy
577 # define pthread_attr_destroy rpl_pthread_attr_destroy
579 _GL_FUNCDECL_RPL (pthread_attr_destroy
, int, (pthread_attr_t
*attr
)
580 _GL_ARG_NONNULL ((1)));
581 _GL_CXXALIAS_RPL (pthread_attr_destroy
, int, (pthread_attr_t
*attr
));
583 # if !@HAVE_PTHREAD_ATTR_DESTROY@
584 _GL_FUNCDECL_SYS (pthread_attr_destroy
, int, (pthread_attr_t
*attr
)
585 _GL_ARG_NONNULL ((1)));
587 _GL_CXXALIAS_SYS (pthread_attr_destroy
, int, (pthread_attr_t
*attr
));
589 _GL_CXXALIASWARN (pthread_attr_destroy
);
590 #elif defined GNULIB_POSIXCHECK
591 # undef pthread_attr_destroy
592 # if HAVE_RAW_DECL_PTHREAD_ATTR_DESTROY
593 _GL_WARN_ON_USE (pthread_attr_destroy
, "pthread_attr_destroy is not portable - "
594 "use gnulib module pthread-thread for portability");
598 #if @GNULIB_PTHREAD_THREAD@
599 # if @REPLACE_PTHREAD_SELF@
600 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
602 # define pthread_self rpl_pthread_self
604 _GL_FUNCDECL_RPL (pthread_self
, pthread_t
, (void) _GL_ATTRIBUTE_PURE
);
605 _GL_CXXALIAS_RPL (pthread_self
, pthread_t
, (void));
607 # if !@HAVE_PTHREAD_SELF@
608 _GL_FUNCDECL_SYS (pthread_self
, pthread_t
, (void) _GL_ATTRIBUTE_PURE
);
610 _GL_CXXALIAS_SYS (pthread_self
, pthread_t
, (void));
612 _GL_CXXALIASWARN (pthread_self
);
613 #elif defined GNULIB_POSIXCHECK
615 # if HAVE_RAW_DECL_PTHREAD_SELF
616 _GL_WARN_ON_USE (pthread_self
, "pthread_self is not portable - "
617 "use gnulib module pthread-thread for portability");
621 #if @GNULIB_PTHREAD_THREAD@
622 # if @REPLACE_PTHREAD_EQUAL@
623 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
624 # undef pthread_equal
625 # define pthread_equal rpl_pthread_equal
627 _GL_FUNCDECL_RPL (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
628 _GL_CXXALIAS_RPL (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
630 # if !@HAVE_PTHREAD_EQUAL@
631 _GL_FUNCDECL_SYS (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
633 _GL_CXXALIAS_SYS (pthread_equal
, int, (pthread_t thread1
, pthread_t thread2
));
635 _GL_CXXALIASWARN (pthread_equal
);
636 #elif defined GNULIB_POSIXCHECK
637 # undef pthread_equal
638 # if HAVE_RAW_DECL_PTHREAD_EQUAL
639 _GL_WARN_ON_USE (pthread_equal
, "pthread_equal is not portable - "
640 "use gnulib module pthread-thread for portability");
644 #if @GNULIB_PTHREAD_THREAD@
645 # if @REPLACE_PTHREAD_DETACH@
646 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
647 # undef pthread_detach
648 # define pthread_detach rpl_pthread_detach
650 _GL_FUNCDECL_RPL (pthread_detach
, int, (pthread_t thread
));
651 _GL_CXXALIAS_RPL (pthread_detach
, int, (pthread_t thread
));
653 # if !@HAVE_PTHREAD_DETACH@
654 _GL_FUNCDECL_SYS (pthread_detach
, int, (pthread_t thread
));
656 _GL_CXXALIAS_SYS (pthread_detach
, int, (pthread_t thread
));
658 _GL_CXXALIASWARN (pthread_detach
);
659 #elif defined GNULIB_POSIXCHECK
660 # undef pthread_detach
661 # if HAVE_RAW_DECL_PTHREAD_DETACH
662 _GL_WARN_ON_USE (pthread_detach
, "pthread_detach is not portable - "
663 "use gnulib module pthread-thread for portability");
667 #if @GNULIB_PTHREAD_THREAD@
668 # if @REPLACE_PTHREAD_JOIN@
669 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
671 # define pthread_join rpl_pthread_join
673 _GL_FUNCDECL_RPL (pthread_join
, int, (pthread_t thread
, void **valuep
));
674 _GL_CXXALIAS_RPL (pthread_join
, int, (pthread_t thread
, void **valuep
));
676 # if !@HAVE_PTHREAD_JOIN@
677 _GL_FUNCDECL_SYS (pthread_join
, int, (pthread_t thread
, void **valuep
));
679 _GL_CXXALIAS_SYS (pthread_join
, int, (pthread_t thread
, void **valuep
));
681 _GL_CXXALIASWARN (pthread_join
);
682 #elif defined GNULIB_POSIXCHECK
684 # if HAVE_RAW_DECL_PTHREAD_JOIN
685 _GL_WARN_ON_USE (pthread_join
, "pthread_join is not portable - "
686 "use gnulib module pthread-thread for portability");
690 #if @GNULIB_PTHREAD_THREAD@
691 # if @REPLACE_PTHREAD_EXIT@
692 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
694 # define pthread_exit rpl_pthread_exit
696 _GL_FUNCDECL_RPL (pthread_exit
, _Noreturn
void, (void *value
));
697 _GL_CXXALIAS_RPL (pthread_exit
, void, (void *value
));
699 # if !@HAVE_PTHREAD_EXIT@
700 _GL_FUNCDECL_SYS (pthread_exit
, _Noreturn
void, (void *value
));
702 /* Need to cast because of AIX with xlclang++. */
703 _GL_CXXALIAS_SYS_CAST (pthread_exit
, void, (void *value
));
705 _GL_CXXALIASWARN (pthread_exit
);
706 #elif defined GNULIB_POSIXCHECK
708 # if HAVE_RAW_DECL_PTHREAD_EXIT
709 _GL_WARN_ON_USE (pthread_exit
, "pthread_exit is not portable - "
710 "use gnulib module pthread-thread for portability");
714 /* =========== Once-only control (initialization) functions =========== */
716 #if @GNULIB_PTHREAD_ONCE@
717 # if @REPLACE_PTHREAD_ONCE@
718 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
720 # define pthread_once rpl_pthread_once
722 _GL_FUNCDECL_RPL (pthread_once
, int,
723 (pthread_once_t
*once_control
, void (*initfunction
) (void))
724 _GL_ARG_NONNULL ((1, 2)));
725 _GL_CXXALIAS_RPL (pthread_once
, int,
726 (pthread_once_t
*once_control
, void (*initfunction
) (void)));
728 # if !@HAVE_PTHREAD_ONCE@
729 _GL_FUNCDECL_SYS (pthread_once
, int,
730 (pthread_once_t
*once_control
, void (*initfunction
) (void))
731 _GL_ARG_NONNULL ((1, 2)));
733 _GL_CXXALIAS_SYS_CAST (pthread_once
, int,
734 (pthread_once_t
*once_control
,
735 void (*initfunction
) (void)));
737 _GL_CXXALIASWARN (pthread_once
);
738 #elif defined GNULIB_POSIXCHECK
740 # if HAVE_RAW_DECL_PTHREAD_ONCE
741 _GL_WARN_ON_USE (pthread_once
, "pthread_once is not portable - "
742 "use gnulib module pthread-once for portability");
746 /* =========== Mutex functions =========== */
748 #if @GNULIB_PTHREAD_MUTEX@
749 # if @REPLACE_PTHREAD_MUTEX_INIT@
750 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
751 # undef pthread_mutex_init
752 # define pthread_mutex_init rpl_pthread_mutex_init
754 _GL_FUNCDECL_RPL (pthread_mutex_init
, int,
755 (pthread_mutex_t
*restrict mutex
,
756 const pthread_mutexattr_t
*restrict attr
)
757 _GL_ARG_NONNULL ((1)));
758 _GL_CXXALIAS_RPL (pthread_mutex_init
, int,
759 (pthread_mutex_t
*restrict mutex
,
760 const pthread_mutexattr_t
*restrict attr
));
762 # if !@HAVE_PTHREAD_MUTEX_INIT@
763 _GL_FUNCDECL_SYS (pthread_mutex_init
, int,
764 (pthread_mutex_t
*restrict mutex
,
765 const pthread_mutexattr_t
*restrict attr
)
766 _GL_ARG_NONNULL ((1)));
768 _GL_CXXALIAS_SYS (pthread_mutex_init
, int,
769 (pthread_mutex_t
*restrict mutex
,
770 const pthread_mutexattr_t
*restrict attr
));
772 _GL_CXXALIASWARN (pthread_mutex_init
);
773 #elif defined GNULIB_POSIXCHECK
774 # undef pthread_mutex_init
775 # if HAVE_RAW_DECL_PTHREAD_MUTEX_INIT
776 _GL_WARN_ON_USE (pthread_mutex_init
, "pthread_mutex_init is not portable - "
777 "use gnulib module pthread-mutex for portability");
781 #if @GNULIB_PTHREAD_MUTEX@
782 # if @REPLACE_PTHREAD_MUTEXATTR_INIT@
783 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
784 # undef pthread_mutexattr_init
785 # define pthread_mutexattr_init rpl_pthread_mutexattr_init
787 _GL_FUNCDECL_RPL (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
)
788 _GL_ARG_NONNULL ((1)));
789 _GL_CXXALIAS_RPL (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
));
791 # if !@HAVE_PTHREAD_MUTEXATTR_INIT@
792 _GL_FUNCDECL_SYS (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
)
793 _GL_ARG_NONNULL ((1)));
795 _GL_CXXALIAS_SYS (pthread_mutexattr_init
, int, (pthread_mutexattr_t
*attr
));
797 _GL_CXXALIASWARN (pthread_mutexattr_init
);
798 #elif defined GNULIB_POSIXCHECK
799 # undef pthread_mutexattr_init
800 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_INIT
801 _GL_WARN_ON_USE (pthread_mutexattr_init
, "pthread_mutexattr_init is not portable - "
802 "use gnulib module pthread-mutex for portability");
806 #if @GNULIB_PTHREAD_MUTEX@
807 # if @REPLACE_PTHREAD_MUTEXATTR_GETTYPE@
808 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
809 # undef pthread_mutexattr_gettype
810 # define pthread_mutexattr_gettype rpl_pthread_mutexattr_gettype
812 _GL_FUNCDECL_RPL (pthread_mutexattr_gettype
, int,
813 (const pthread_mutexattr_t
*restrict attr
,
815 _GL_ARG_NONNULL ((1, 2)));
816 _GL_CXXALIAS_RPL (pthread_mutexattr_gettype
, int,
817 (const pthread_mutexattr_t
*restrict attr
,
818 int *restrict typep
));
820 # if !@HAVE_PTHREAD_MUTEXATTR_GETTYPE@
821 _GL_FUNCDECL_SYS (pthread_mutexattr_gettype
, int,
822 (const pthread_mutexattr_t
*restrict attr
,
824 _GL_ARG_NONNULL ((1, 2)));
826 /* Need to cast, because on FreeBSD the first parameter is
827 pthread_mutexattr_t *attr. */
828 _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_gettype
, int,
829 (const pthread_mutexattr_t
*restrict attr
,
830 int *restrict typep
));
832 _GL_CXXALIASWARN (pthread_mutexattr_gettype
);
833 #elif defined GNULIB_POSIXCHECK
834 # undef pthread_mutexattr_gettype
835 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETTYPE
836 _GL_WARN_ON_USE (pthread_mutexattr_gettype
, "pthread_mutexattr_gettype is not portable - "
837 "use gnulib module pthread-mutex for portability");
841 #if @GNULIB_PTHREAD_MUTEX@
842 # if @REPLACE_PTHREAD_MUTEXATTR_SETTYPE@
843 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
844 # undef pthread_mutexattr_settype
845 # define pthread_mutexattr_settype rpl_pthread_mutexattr_settype
847 _GL_FUNCDECL_RPL (pthread_mutexattr_settype
, int,
848 (pthread_mutexattr_t
*attr
, int type
) _GL_ARG_NONNULL ((1)));
849 _GL_CXXALIAS_RPL (pthread_mutexattr_settype
, int,
850 (pthread_mutexattr_t
*attr
, int type
));
852 # if !@HAVE_PTHREAD_MUTEXATTR_SETTYPE@
853 _GL_FUNCDECL_SYS (pthread_mutexattr_settype
, int,
854 (pthread_mutexattr_t
*attr
, int type
) _GL_ARG_NONNULL ((1)));
856 _GL_CXXALIAS_SYS (pthread_mutexattr_settype
, int,
857 (pthread_mutexattr_t
*attr
, int type
));
859 _GL_CXXALIASWARN (pthread_mutexattr_settype
);
860 #elif defined GNULIB_POSIXCHECK
861 # undef pthread_mutexattr_settype
862 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETTYPE
863 _GL_WARN_ON_USE (pthread_mutexattr_settype
, "pthread_mutexattr_settype is not portable - "
864 "use gnulib module pthread-mutex for portability");
868 #if @GNULIB_PTHREAD_MUTEX@
869 # if @REPLACE_PTHREAD_MUTEXATTR_GETROBUST@
870 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
871 # undef pthread_mutexattr_getrobust
872 # define pthread_mutexattr_getrobust rpl_pthread_mutexattr_getrobust
874 _GL_FUNCDECL_RPL (pthread_mutexattr_getrobust
, int,
875 (const pthread_mutexattr_t
*restrict attr
,
876 int *restrict robustp
)
877 _GL_ARG_NONNULL ((1, 2)));
878 _GL_CXXALIAS_RPL (pthread_mutexattr_getrobust
, int,
879 (const pthread_mutexattr_t
*restrict attr
,
880 int *restrict robustp
));
882 # if !@HAVE_PTHREAD_MUTEXATTR_GETROBUST@
883 _GL_FUNCDECL_SYS (pthread_mutexattr_getrobust
, int,
884 (const pthread_mutexattr_t
*restrict attr
,
885 int *restrict robustp
)
886 _GL_ARG_NONNULL ((1, 2)));
888 /* Need to cast, because on FreeBSD the first parameter is
889 pthread_mutexattr_t *attr. */
890 _GL_CXXALIAS_SYS_CAST (pthread_mutexattr_getrobust
, int,
891 (const pthread_mutexattr_t
*restrict attr
,
892 int *restrict robustp
));
895 _GL_CXXALIASWARN (pthread_mutexattr_getrobust
);
897 #elif defined GNULIB_POSIXCHECK
898 # undef pthread_mutexattr_getrobust
899 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_GETROBUST
900 _GL_WARN_ON_USE (pthread_mutexattr_getrobust
, "pthread_mutexattr_getrobust is not portable - "
901 "use gnulib module pthread-mutex for portability");
905 #if @GNULIB_PTHREAD_MUTEX@
906 # if @REPLACE_PTHREAD_MUTEXATTR_SETROBUST@
907 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
908 # undef pthread_mutexattr_setrobust
909 # define pthread_mutexattr_setrobust rpl_pthread_mutexattr_setrobust
911 _GL_FUNCDECL_RPL (pthread_mutexattr_setrobust
, int,
912 (pthread_mutexattr_t
*attr
, int robust
)
913 _GL_ARG_NONNULL ((1)));
914 _GL_CXXALIAS_RPL (pthread_mutexattr_setrobust
, int,
915 (pthread_mutexattr_t
*attr
, int robust
));
917 # if !@HAVE_PTHREAD_MUTEXATTR_SETROBUST@
918 _GL_FUNCDECL_SYS (pthread_mutexattr_setrobust
, int,
919 (pthread_mutexattr_t
*attr
, int robust
)
920 _GL_ARG_NONNULL ((1)));
922 _GL_CXXALIAS_SYS (pthread_mutexattr_setrobust
, int,
923 (pthread_mutexattr_t
*attr
, int robust
));
926 _GL_CXXALIASWARN (pthread_mutexattr_setrobust
);
928 #elif defined GNULIB_POSIXCHECK
929 # undef pthread_mutexattr_setrobust
930 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_SETROBUST
931 _GL_WARN_ON_USE (pthread_mutexattr_setrobust
, "pthread_mutexattr_setrobust is not portable - "
932 "use gnulib module pthread-mutex for portability");
936 #if @GNULIB_PTHREAD_MUTEX@
937 # if @REPLACE_PTHREAD_MUTEXATTR_DESTROY@
938 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
939 # undef pthread_mutexattr_destroy
940 # define pthread_mutexattr_destroy rpl_pthread_mutexattr_destroy
942 _GL_FUNCDECL_RPL (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
)
943 _GL_ARG_NONNULL ((1)));
944 _GL_CXXALIAS_RPL (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
));
946 # if !@HAVE_PTHREAD_MUTEXATTR_DESTROY@
947 _GL_FUNCDECL_SYS (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
)
948 _GL_ARG_NONNULL ((1)));
950 _GL_CXXALIAS_SYS (pthread_mutexattr_destroy
, int, (pthread_mutexattr_t
*attr
));
952 _GL_CXXALIASWARN (pthread_mutexattr_destroy
);
953 #elif defined GNULIB_POSIXCHECK
954 # undef pthread_mutexattr_destroy
955 # if HAVE_RAW_DECL_PTHREAD_MUTEXATTR_DESTROY
956 _GL_WARN_ON_USE (pthread_mutexattr_destroy
, "pthread_mutexattr_destroy is not portable - "
957 "use gnulib module pthread-mutex for portability");
961 #if @GNULIB_PTHREAD_MUTEX@
962 # if @REPLACE_PTHREAD_MUTEX_LOCK@
963 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
964 # undef pthread_mutex_lock
965 # define pthread_mutex_lock rpl_pthread_mutex_lock
967 _GL_FUNCDECL_RPL (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
)
968 _GL_ARG_NONNULL ((1)));
969 _GL_CXXALIAS_RPL (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
));
971 # if !@HAVE_PTHREAD_MUTEX_LOCK@
972 _GL_FUNCDECL_SYS (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
)
973 _GL_ARG_NONNULL ((1)));
975 _GL_CXXALIAS_SYS (pthread_mutex_lock
, int, (pthread_mutex_t
*mutex
));
978 _GL_CXXALIASWARN (pthread_mutex_lock
);
980 #elif defined GNULIB_POSIXCHECK
981 # undef pthread_mutex_lock
982 # if HAVE_RAW_DECL_PTHREAD_MUTEX_LOCK
983 _GL_WARN_ON_USE (pthread_mutex_lock
, "pthread_mutex_lock is not portable - "
984 "use gnulib module pthread-mutex for portability");
988 #if @GNULIB_PTHREAD_MUTEX@
989 # if @REPLACE_PTHREAD_MUTEX_TRYLOCK@
990 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
991 # undef pthread_mutex_trylock
992 # define pthread_mutex_trylock rpl_pthread_mutex_trylock
994 _GL_FUNCDECL_RPL (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
)
995 _GL_ARG_NONNULL ((1)));
996 _GL_CXXALIAS_RPL (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
));
998 # if !@HAVE_PTHREAD_MUTEX_TRYLOCK@
999 _GL_FUNCDECL_SYS (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
)
1000 _GL_ARG_NONNULL ((1)));
1002 _GL_CXXALIAS_SYS (pthread_mutex_trylock
, int, (pthread_mutex_t
*mutex
));
1004 _GL_CXXALIASWARN (pthread_mutex_trylock
);
1005 #elif defined GNULIB_POSIXCHECK
1006 # undef pthread_mutex_trylock
1007 # if HAVE_RAW_DECL_PTHREAD_MUTEX_TRYLOCK
1008 _GL_WARN_ON_USE (pthread_mutex_trylock
, "pthread_mutex_trylock is not portable - "
1009 "use gnulib module pthread-mutex for portability");
1013 #if @GNULIB_PTHREAD_MUTEX_TIMEDLOCK@
1014 # if @REPLACE_PTHREAD_MUTEX_TIMEDLOCK@
1015 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1016 # undef pthread_mutex_timedlock
1017 # define pthread_mutex_timedlock rpl_pthread_mutex_timedlock
1019 _GL_FUNCDECL_RPL (pthread_mutex_timedlock
, int,
1020 (pthread_mutex_t
*restrict mutex
,
1021 const struct timespec
*restrict abstime
)
1022 _GL_ARG_NONNULL ((1, 2)));
1023 _GL_CXXALIAS_RPL (pthread_mutex_timedlock
, int,
1024 (pthread_mutex_t
*restrict mutex
,
1025 const struct timespec
*restrict abstime
));
1027 # if !@HAVE_PTHREAD_MUTEX_TIMEDLOCK@
1028 _GL_FUNCDECL_SYS (pthread_mutex_timedlock
, int,
1029 (pthread_mutex_t
*restrict mutex
,
1030 const struct timespec
*restrict abstime
)
1031 _GL_ARG_NONNULL ((1, 2)));
1033 _GL_CXXALIAS_SYS (pthread_mutex_timedlock
, int,
1034 (pthread_mutex_t
*restrict mutex
,
1035 const struct timespec
*restrict abstime
));
1037 _GL_CXXALIASWARN (pthread_mutex_timedlock
);
1038 #elif defined GNULIB_POSIXCHECK
1039 # undef pthread_mutex_timedlock
1040 # if HAVE_RAW_DECL_PTHREAD_MUTEX_TIMEDLOCK
1041 _GL_WARN_ON_USE (pthread_mutex_timedlock
, "pthread_mutex_timedlock is not portable - "
1042 "use gnulib module pthread_mutex_timedlock for portability");
1046 #if @GNULIB_PTHREAD_MUTEX@
1047 # if @REPLACE_PTHREAD_MUTEX_UNLOCK@
1048 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1049 # undef pthread_mutex_unlock
1050 # define pthread_mutex_unlock rpl_pthread_mutex_unlock
1052 _GL_FUNCDECL_RPL (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
)
1053 _GL_ARG_NONNULL ((1)));
1054 _GL_CXXALIAS_RPL (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
));
1056 # if !@HAVE_PTHREAD_MUTEX_UNLOCK@
1057 _GL_FUNCDECL_SYS (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
)
1058 _GL_ARG_NONNULL ((1)));
1060 _GL_CXXALIAS_SYS (pthread_mutex_unlock
, int, (pthread_mutex_t
*mutex
));
1062 _GL_CXXALIASWARN (pthread_mutex_unlock
);
1063 #elif defined GNULIB_POSIXCHECK
1064 # undef pthread_mutex_unlock
1065 # if HAVE_RAW_DECL_PTHREAD_MUTEX_UNLOCK
1066 _GL_WARN_ON_USE (pthread_mutex_unlock
, "pthread_mutex_unlock is not portable - "
1067 "use gnulib module pthread-mutex for portability");
1071 #if @GNULIB_PTHREAD_MUTEX@
1072 # if @REPLACE_PTHREAD_MUTEX_DESTROY@
1073 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1074 # undef pthread_mutex_destroy
1075 # define pthread_mutex_destroy rpl_pthread_mutex_destroy
1077 _GL_FUNCDECL_RPL (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
)
1078 _GL_ARG_NONNULL ((1)));
1079 _GL_CXXALIAS_RPL (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
));
1081 # if !@HAVE_PTHREAD_MUTEX_DESTROY@
1082 _GL_FUNCDECL_SYS (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
)
1083 _GL_ARG_NONNULL ((1)));
1085 _GL_CXXALIAS_SYS (pthread_mutex_destroy
, int, (pthread_mutex_t
*mutex
));
1087 _GL_CXXALIASWARN (pthread_mutex_destroy
);
1088 #elif defined GNULIB_POSIXCHECK
1089 # undef pthread_mutex_destroy
1090 # if HAVE_RAW_DECL_PTHREAD_MUTEX_DESTROY
1091 _GL_WARN_ON_USE (pthread_mutex_destroy
, "pthread_mutex_destroy is not portable - "
1092 "use gnulib module pthread-mutex for portability");
1096 /* =========== Read-write lock functions =========== */
1098 #if @GNULIB_PTHREAD_RWLOCK@
1099 # if @REPLACE_PTHREAD_RWLOCK_INIT@
1100 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1101 # undef pthread_rwlock_init
1102 # define pthread_rwlock_init rpl_pthread_rwlock_init
1104 _GL_FUNCDECL_RPL (pthread_rwlock_init
, int,
1105 (pthread_rwlock_t
*restrict lock
,
1106 const pthread_rwlockattr_t
*restrict attr
)
1107 _GL_ARG_NONNULL ((1)));
1108 _GL_CXXALIAS_RPL (pthread_rwlock_init
, int,
1109 (pthread_rwlock_t
*restrict lock
,
1110 const pthread_rwlockattr_t
*restrict attr
));
1112 # if !@HAVE_PTHREAD_RWLOCK_INIT@
1113 _GL_FUNCDECL_SYS (pthread_rwlock_init
, int,
1114 (pthread_rwlock_t
*restrict lock
,
1115 const pthread_rwlockattr_t
*restrict attr
)
1116 _GL_ARG_NONNULL ((1)));
1118 _GL_CXXALIAS_SYS (pthread_rwlock_init
, int,
1119 (pthread_rwlock_t
*restrict lock
,
1120 const pthread_rwlockattr_t
*restrict attr
));
1122 _GL_CXXALIASWARN (pthread_rwlock_init
);
1123 #elif defined GNULIB_POSIXCHECK
1124 # undef pthread_rwlock_init
1125 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_INIT
1126 _GL_WARN_ON_USE (pthread_rwlock_init
, "pthread_rwlock_init is not portable - "
1127 "use gnulib module pthread-rwlock for portability");
1131 #if @GNULIB_PTHREAD_RWLOCK@
1132 # if @REPLACE_PTHREAD_RWLOCKATTR_INIT@
1133 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1134 # undef pthread_rwlockattr_init
1135 # define pthread_rwlockattr_init rpl_pthread_rwlockattr_init
1137 _GL_FUNCDECL_RPL (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
)
1138 _GL_ARG_NONNULL ((1)));
1139 _GL_CXXALIAS_RPL (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
));
1141 # if !@HAVE_PTHREAD_RWLOCKATTR_INIT@
1142 _GL_FUNCDECL_SYS (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
)
1143 _GL_ARG_NONNULL ((1)));
1145 _GL_CXXALIAS_SYS (pthread_rwlockattr_init
, int, (pthread_rwlockattr_t
*attr
));
1147 _GL_CXXALIASWARN (pthread_rwlockattr_init
);
1148 #elif defined GNULIB_POSIXCHECK
1149 # undef pthread_rwlockattr_init
1150 # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_INIT
1151 _GL_WARN_ON_USE (pthread_rwlockattr_init
, "pthread_rwlockattr_init is not portable - "
1152 "use gnulib module pthread-rwlock for portability");
1156 #if @GNULIB_PTHREAD_RWLOCK@
1157 # if @REPLACE_PTHREAD_RWLOCKATTR_DESTROY@
1158 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1159 # undef pthread_rwlockattr_destroy
1160 # define pthread_rwlockattr_destroy rpl_pthread_rwlockattr_destroy
1162 _GL_FUNCDECL_RPL (pthread_rwlockattr_destroy
, int,
1163 (pthread_rwlockattr_t
*attr
) _GL_ARG_NONNULL ((1)));
1164 _GL_CXXALIAS_RPL (pthread_rwlockattr_destroy
, int,
1165 (pthread_rwlockattr_t
*attr
));
1167 # if !@HAVE_PTHREAD_RWLOCKATTR_DESTROY@
1168 _GL_FUNCDECL_SYS (pthread_rwlockattr_destroy
, int,
1169 (pthread_rwlockattr_t
*attr
) _GL_ARG_NONNULL ((1)));
1171 _GL_CXXALIAS_SYS (pthread_rwlockattr_destroy
, int,
1172 (pthread_rwlockattr_t
*attr
));
1174 _GL_CXXALIASWARN (pthread_rwlockattr_destroy
);
1175 #elif defined GNULIB_POSIXCHECK
1176 # undef pthread_rwlockattr_destroy
1177 # if HAVE_RAW_DECL_PTHREAD_RWLOCKATTR_DESTROY
1178 _GL_WARN_ON_USE (pthread_rwlockattr_destroy
, "pthread_rwlockattr_destroy is not portable - "
1179 "use gnulib module pthread-rwlock for portability");
1183 #if @GNULIB_PTHREAD_RWLOCK@
1184 # if @REPLACE_PTHREAD_RWLOCK_RDLOCK@
1185 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1186 # undef pthread_rwlock_rdlock
1187 # define pthread_rwlock_rdlock rpl_pthread_rwlock_rdlock
1189 _GL_FUNCDECL_RPL (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
)
1190 _GL_ARG_NONNULL ((1)));
1191 _GL_CXXALIAS_RPL (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
));
1193 # if !@HAVE_PTHREAD_RWLOCK_RDLOCK@
1194 _GL_FUNCDECL_SYS (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
)
1195 _GL_ARG_NONNULL ((1)));
1197 _GL_CXXALIAS_SYS (pthread_rwlock_rdlock
, int, (pthread_rwlock_t
*lock
));
1199 _GL_CXXALIASWARN (pthread_rwlock_rdlock
);
1200 #elif defined GNULIB_POSIXCHECK
1201 # undef pthread_rwlock_rdlock
1202 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_RDLOCK
1203 _GL_WARN_ON_USE (pthread_rwlock_rdlock
, "pthread_rwlock_rdlock is not portable - "
1204 "use gnulib module pthread-rwlock for portability");
1208 #if @GNULIB_PTHREAD_RWLOCK@
1209 # if @REPLACE_PTHREAD_RWLOCK_WRLOCK@
1210 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1211 # undef pthread_rwlock_wrlock
1212 # define pthread_rwlock_wrlock rpl_pthread_rwlock_wrlock
1214 _GL_FUNCDECL_RPL (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
)
1215 _GL_ARG_NONNULL ((1)));
1216 _GL_CXXALIAS_RPL (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
));
1218 # if !@HAVE_PTHREAD_RWLOCK_WRLOCK@
1219 _GL_FUNCDECL_SYS (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
)
1220 _GL_ARG_NONNULL ((1)));
1222 _GL_CXXALIAS_SYS (pthread_rwlock_wrlock
, int, (pthread_rwlock_t
*lock
));
1224 _GL_CXXALIASWARN (pthread_rwlock_wrlock
);
1225 #elif defined GNULIB_POSIXCHECK
1226 # undef pthread_rwlock_wrlock
1227 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_WRLOCK
1228 _GL_WARN_ON_USE (pthread_rwlock_wrlock
, "pthread_rwlock_wrlock is not portable - "
1229 "use gnulib module pthread-rwlock for portability");
1233 #if @GNULIB_PTHREAD_RWLOCK@
1234 # if @REPLACE_PTHREAD_RWLOCK_TRYRDLOCK@
1235 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1236 # undef pthread_rwlock_tryrdlock
1237 # define pthread_rwlock_tryrdlock rpl_pthread_rwlock_tryrdlock
1239 _GL_FUNCDECL_RPL (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
)
1240 _GL_ARG_NONNULL ((1)));
1241 _GL_CXXALIAS_RPL (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
));
1243 # if !@HAVE_PTHREAD_RWLOCK_TRYRDLOCK@
1244 _GL_FUNCDECL_SYS (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
)
1245 _GL_ARG_NONNULL ((1)));
1247 _GL_CXXALIAS_SYS (pthread_rwlock_tryrdlock
, int, (pthread_rwlock_t
*lock
));
1249 _GL_CXXALIASWARN (pthread_rwlock_tryrdlock
);
1250 #elif defined GNULIB_POSIXCHECK
1251 # undef pthread_rwlock_tryrdlock
1252 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYRDLOCK
1253 _GL_WARN_ON_USE (pthread_rwlock_tryrdlock
, "pthread_rwlock_tryrdlock is not portable - "
1254 "use gnulib module pthread-rwlock for portability");
1258 #if @GNULIB_PTHREAD_RWLOCK@
1259 # if @REPLACE_PTHREAD_RWLOCK_TRYWRLOCK@
1260 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1261 # undef pthread_rwlock_trywrlock
1262 # define pthread_rwlock_trywrlock rpl_pthread_rwlock_trywrlock
1264 _GL_FUNCDECL_RPL (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
)
1265 _GL_ARG_NONNULL ((1)));
1266 _GL_CXXALIAS_RPL (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
));
1268 # if !@HAVE_PTHREAD_RWLOCK_TRYWRLOCK@
1269 _GL_FUNCDECL_SYS (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
)
1270 _GL_ARG_NONNULL ((1)));
1272 _GL_CXXALIAS_SYS (pthread_rwlock_trywrlock
, int, (pthread_rwlock_t
*lock
));
1274 _GL_CXXALIASWARN (pthread_rwlock_trywrlock
);
1275 #elif defined GNULIB_POSIXCHECK
1276 # undef pthread_rwlock_trywrlock
1277 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TRYWRLOCK
1278 _GL_WARN_ON_USE (pthread_rwlock_trywrlock
, "pthread_rwlock_trywrlock is not portable - "
1279 "use gnulib module pthread-rwlock for portability");
1283 #if @GNULIB_PTHREAD_RWLOCK@
1284 # if @REPLACE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1285 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1286 # undef pthread_rwlock_timedrdlock
1287 # define pthread_rwlock_timedrdlock rpl_pthread_rwlock_timedrdlock
1289 _GL_FUNCDECL_RPL (pthread_rwlock_timedrdlock
, int,
1290 (pthread_rwlock_t
*restrict lock
,
1291 const struct timespec
*restrict abstime
)
1292 _GL_ARG_NONNULL ((1, 2)));
1293 _GL_CXXALIAS_RPL (pthread_rwlock_timedrdlock
, int,
1294 (pthread_rwlock_t
*restrict lock
,
1295 const struct timespec
*restrict abstime
));
1297 # if !@HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK@
1298 _GL_FUNCDECL_SYS (pthread_rwlock_timedrdlock
, int,
1299 (pthread_rwlock_t
*restrict lock
,
1300 const struct timespec
*restrict abstime
)
1301 _GL_ARG_NONNULL ((1, 2)));
1303 _GL_CXXALIAS_SYS (pthread_rwlock_timedrdlock
, int,
1304 (pthread_rwlock_t
*restrict lock
,
1305 const struct timespec
*restrict abstime
));
1307 _GL_CXXALIASWARN (pthread_rwlock_timedrdlock
);
1308 #elif defined GNULIB_POSIXCHECK
1309 # undef pthread_rwlock_timedrdlock
1310 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDRDLOCK
1311 _GL_WARN_ON_USE (pthread_rwlock_timedrdlock
, "pthread_rwlock_timedrdlock is not portable - "
1312 "use gnulib module pthread-rwlock for portability");
1316 #if @GNULIB_PTHREAD_RWLOCK@
1317 # if @REPLACE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1318 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1319 # undef pthread_rwlock_timedwrlock
1320 # define pthread_rwlock_timedwrlock rpl_pthread_rwlock_timedwrlock
1322 _GL_FUNCDECL_RPL (pthread_rwlock_timedwrlock
, int,
1323 (pthread_rwlock_t
*restrict lock
,
1324 const struct timespec
*restrict abstime
)
1325 _GL_ARG_NONNULL ((1, 2)));
1326 _GL_CXXALIAS_RPL (pthread_rwlock_timedwrlock
, int,
1327 (pthread_rwlock_t
*restrict lock
,
1328 const struct timespec
*restrict abstime
));
1330 # if !@HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK@
1331 _GL_FUNCDECL_SYS (pthread_rwlock_timedwrlock
, int,
1332 (pthread_rwlock_t
*restrict lock
,
1333 const struct timespec
*restrict abstime
)
1334 _GL_ARG_NONNULL ((1, 2)));
1336 _GL_CXXALIAS_SYS (pthread_rwlock_timedwrlock
, int,
1337 (pthread_rwlock_t
*restrict lock
,
1338 const struct timespec
*restrict abstime
));
1340 _GL_CXXALIASWARN (pthread_rwlock_timedwrlock
);
1341 #elif defined GNULIB_POSIXCHECK
1342 # undef pthread_rwlock_timedwrlock
1343 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_TIMEDWRLOCK
1344 _GL_WARN_ON_USE (pthread_rwlock_timedwrlock
, "pthread_rwlock_timedwrlock is not portable - "
1345 "use gnulib module pthread-rwlock for portability");
1349 #if @GNULIB_PTHREAD_RWLOCK@
1350 # if @REPLACE_PTHREAD_RWLOCK_UNLOCK@
1351 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1352 # undef pthread_rwlock_unlock
1353 # define pthread_rwlock_unlock rpl_pthread_rwlock_unlock
1355 _GL_FUNCDECL_RPL (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
)
1356 _GL_ARG_NONNULL ((1)));
1357 _GL_CXXALIAS_RPL (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
));
1359 # if !@HAVE_PTHREAD_RWLOCK_UNLOCK@
1360 _GL_FUNCDECL_SYS (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
)
1361 _GL_ARG_NONNULL ((1)));
1363 _GL_CXXALIAS_SYS (pthread_rwlock_unlock
, int, (pthread_rwlock_t
*lock
));
1365 _GL_CXXALIASWARN (pthread_rwlock_unlock
);
1366 #elif defined GNULIB_POSIXCHECK
1367 # undef pthread_rwlock_unlock
1368 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_UNLOCK
1369 _GL_WARN_ON_USE (pthread_rwlock_unlock
, "pthread_rwlock_unlock is not portable - "
1370 "use gnulib module pthread-rwlock for portability");
1374 #if @GNULIB_PTHREAD_RWLOCK@
1375 # if @REPLACE_PTHREAD_RWLOCK_DESTROY@
1376 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1377 # undef pthread_rwlock_destroy
1378 # define pthread_rwlock_destroy rpl_pthread_rwlock_destroy
1380 _GL_FUNCDECL_RPL (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
)
1381 _GL_ARG_NONNULL ((1)));
1382 _GL_CXXALIAS_RPL (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
));
1384 # if !@HAVE_PTHREAD_RWLOCK_DESTROY@
1385 _GL_FUNCDECL_SYS (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
)
1386 _GL_ARG_NONNULL ((1)));
1388 _GL_CXXALIAS_SYS (pthread_rwlock_destroy
, int, (pthread_rwlock_t
*lock
));
1390 _GL_CXXALIASWARN (pthread_rwlock_destroy
);
1391 #elif defined GNULIB_POSIXCHECK
1392 # undef pthread_rwlock_destroy
1393 # if HAVE_RAW_DECL_PTHREAD_RWLOCK_DESTROY
1394 _GL_WARN_ON_USE (pthread_rwlock_destroy
, "pthread_rwlock_destroy is not portable - "
1395 "use gnulib module pthread-rwlock for portability");
1399 /* =========== Condition variable functions =========== */
1401 #if @GNULIB_PTHREAD_COND@
1402 # if @REPLACE_PTHREAD_COND_INIT@
1403 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1404 # undef pthread_cond_init
1405 # define pthread_cond_init rpl_pthread_cond_init
1407 _GL_FUNCDECL_RPL (pthread_cond_init
, int,
1408 (pthread_cond_t
*restrict cond
,
1409 const pthread_condattr_t
*restrict attr
)
1410 _GL_ARG_NONNULL ((1)));
1411 _GL_CXXALIAS_RPL (pthread_cond_init
, int,
1412 (pthread_cond_t
*restrict cond
,
1413 const pthread_condattr_t
*restrict attr
));
1415 # if !@HAVE_PTHREAD_COND_INIT@
1416 _GL_FUNCDECL_SYS (pthread_cond_init
, int,
1417 (pthread_cond_t
*restrict cond
,
1418 const pthread_condattr_t
*restrict attr
)
1419 _GL_ARG_NONNULL ((1)));
1421 _GL_CXXALIAS_SYS (pthread_cond_init
, int,
1422 (pthread_cond_t
*restrict cond
,
1423 const pthread_condattr_t
*restrict attr
));
1425 _GL_CXXALIASWARN (pthread_cond_init
);
1426 #elif defined GNULIB_POSIXCHECK
1427 # undef pthread_cond_init
1428 # if HAVE_RAW_DECL_PTHREAD_COND_INIT
1429 _GL_WARN_ON_USE (pthread_cond_init
, "pthread_cond_init is not portable - "
1430 "use gnulib module pthread-cond for portability");
1434 #if @GNULIB_PTHREAD_COND@
1435 # if @REPLACE_PTHREAD_CONDATTR_INIT@
1436 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1437 # undef pthread_condattr_init
1438 # define pthread_condattr_init rpl_pthread_condattr_init
1440 _GL_FUNCDECL_RPL (pthread_condattr_init
, int, (pthread_condattr_t
*attr
)
1441 _GL_ARG_NONNULL ((1)));
1442 _GL_CXXALIAS_RPL (pthread_condattr_init
, int, (pthread_condattr_t
*attr
));
1444 # if !@HAVE_PTHREAD_CONDATTR_INIT@
1445 _GL_FUNCDECL_SYS (pthread_condattr_init
, int, (pthread_condattr_t
*attr
)
1446 _GL_ARG_NONNULL ((1)));
1448 _GL_CXXALIAS_SYS (pthread_condattr_init
, int, (pthread_condattr_t
*attr
));
1450 _GL_CXXALIASWARN (pthread_condattr_init
);
1451 #elif defined GNULIB_POSIXCHECK
1452 # undef pthread_condattr_init
1453 # if HAVE_RAW_DECL_PTHREAD_CONDATTR_INIT
1454 _GL_WARN_ON_USE (pthread_condattr_init
, "pthread_condattr_init is not portable - "
1455 "use gnulib module pthread-cond for portability");
1459 #if @GNULIB_PTHREAD_COND@
1460 # if @REPLACE_PTHREAD_CONDATTR_DESTROY@
1461 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1462 # undef pthread_condattr_destroy
1463 # define pthread_condattr_destroy rpl_pthread_condattr_destroy
1465 _GL_FUNCDECL_RPL (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
)
1466 _GL_ARG_NONNULL ((1)));
1467 _GL_CXXALIAS_RPL (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
));
1469 # if !@HAVE_PTHREAD_CONDATTR_DESTROY@
1470 _GL_FUNCDECL_SYS (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
)
1471 _GL_ARG_NONNULL ((1)));
1473 _GL_CXXALIAS_SYS (pthread_condattr_destroy
, int, (pthread_condattr_t
*attr
));
1475 _GL_CXXALIASWARN (pthread_condattr_destroy
);
1476 #elif defined GNULIB_POSIXCHECK
1477 # undef pthread_condattr_destroy
1478 # if HAVE_RAW_DECL_PTHREAD_CONDATTR_DESTROY
1479 _GL_WARN_ON_USE (pthread_condattr_destroy
, "pthread_condattr_destroy is not portable - "
1480 "use gnulib module pthread-cond for portability");
1484 #if @GNULIB_PTHREAD_COND@
1485 # if @REPLACE_PTHREAD_COND_WAIT@
1486 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1487 # undef pthread_cond_wait
1488 # define pthread_cond_wait rpl_pthread_cond_wait
1490 _GL_FUNCDECL_RPL (pthread_cond_wait
, int,
1491 (pthread_cond_t
*restrict cond
,
1492 pthread_mutex_t
*restrict mutex
)
1493 _GL_ARG_NONNULL ((1, 2)));
1494 _GL_CXXALIAS_RPL (pthread_cond_wait
, int,
1495 (pthread_cond_t
*restrict cond
,
1496 pthread_mutex_t
*restrict mutex
));
1498 # if !@HAVE_PTHREAD_COND_WAIT@
1499 _GL_FUNCDECL_SYS (pthread_cond_wait
, int,
1500 (pthread_cond_t
*restrict cond
,
1501 pthread_mutex_t
*restrict mutex
)
1502 _GL_ARG_NONNULL ((1, 2)));
1504 _GL_CXXALIAS_SYS (pthread_cond_wait
, int,
1505 (pthread_cond_t
*restrict cond
,
1506 pthread_mutex_t
*restrict mutex
));
1508 _GL_CXXALIASWARN (pthread_cond_wait
);
1509 #elif defined GNULIB_POSIXCHECK
1510 # undef pthread_cond_wait
1511 # if HAVE_RAW_DECL_PTHREAD_COND_WAIT
1512 _GL_WARN_ON_USE (pthread_cond_wait
, "pthread_cond_wait is not portable - "
1513 "use gnulib module pthread-cond for portability");
1517 #if @GNULIB_PTHREAD_COND@
1518 # if @REPLACE_PTHREAD_COND_TIMEDWAIT@
1519 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1520 # undef pthread_cond_timedwait
1521 # define pthread_cond_timedwait rpl_pthread_cond_timedwait
1523 _GL_FUNCDECL_RPL (pthread_cond_timedwait
, int,
1524 (pthread_cond_t
*restrict cond
,
1525 pthread_mutex_t
*restrict mutex
,
1526 const struct timespec
*restrict abstime
)
1527 _GL_ARG_NONNULL ((1, 2, 3)));
1528 _GL_CXXALIAS_RPL (pthread_cond_timedwait
, int,
1529 (pthread_cond_t
*restrict cond
,
1530 pthread_mutex_t
*restrict mutex
,
1531 const struct timespec
*restrict abstime
));
1533 # if !@HAVE_PTHREAD_COND_TIMEDWAIT@
1534 _GL_FUNCDECL_SYS (pthread_cond_timedwait
, int,
1535 (pthread_cond_t
*restrict cond
,
1536 pthread_mutex_t
*restrict mutex
,
1537 const struct timespec
*restrict abstime
)
1538 _GL_ARG_NONNULL ((1, 2, 3)));
1540 _GL_CXXALIAS_SYS (pthread_cond_timedwait
, int,
1541 (pthread_cond_t
*restrict cond
,
1542 pthread_mutex_t
*restrict mutex
,
1543 const struct timespec
*restrict abstime
));
1545 _GL_CXXALIASWARN (pthread_cond_timedwait
);
1546 #elif defined GNULIB_POSIXCHECK
1547 # undef pthread_cond_timedwait
1548 # if HAVE_RAW_DECL_PTHREAD_COND_TIMEDWAIT
1549 _GL_WARN_ON_USE (pthread_cond_timedwait
, "pthread_cond_timedwait is not portable - "
1550 "use gnulib module pthread-cond for portability");
1554 #if @GNULIB_PTHREAD_COND@
1555 # if @REPLACE_PTHREAD_COND_SIGNAL@
1556 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1557 # undef pthread_cond_signal
1558 # define pthread_cond_signal rpl_pthread_cond_signal
1560 _GL_FUNCDECL_RPL (pthread_cond_signal
, int, (pthread_cond_t
*cond
)
1561 _GL_ARG_NONNULL ((1)));
1562 _GL_CXXALIAS_RPL (pthread_cond_signal
, int, (pthread_cond_t
*cond
));
1564 # if !@HAVE_PTHREAD_COND_SIGNAL@
1565 _GL_FUNCDECL_SYS (pthread_cond_signal
, int, (pthread_cond_t
*cond
)
1566 _GL_ARG_NONNULL ((1)));
1568 _GL_CXXALIAS_SYS (pthread_cond_signal
, int, (pthread_cond_t
*cond
));
1570 _GL_CXXALIASWARN (pthread_cond_signal
);
1571 #elif defined GNULIB_POSIXCHECK
1572 # undef pthread_cond_signal
1573 # if HAVE_RAW_DECL_PTHREAD_COND_SIGNAL
1574 _GL_WARN_ON_USE (pthread_cond_signal
, "pthread_cond_signal is not portable - "
1575 "use gnulib module pthread-cond for portability");
1579 #if @GNULIB_PTHREAD_COND@
1580 # if @REPLACE_PTHREAD_COND_BROADCAST@
1581 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1582 # undef pthread_cond_broadcast
1583 # define pthread_cond_broadcast rpl_pthread_cond_broadcast
1585 _GL_FUNCDECL_RPL (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
)
1586 _GL_ARG_NONNULL ((1)));
1587 _GL_CXXALIAS_RPL (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
));
1589 # if !@HAVE_PTHREAD_COND_BROADCAST@
1590 _GL_FUNCDECL_SYS (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
)
1591 _GL_ARG_NONNULL ((1)));
1593 _GL_CXXALIAS_SYS (pthread_cond_broadcast
, int, (pthread_cond_t
*cond
));
1595 _GL_CXXALIASWARN (pthread_cond_broadcast
);
1596 #elif defined GNULIB_POSIXCHECK
1597 # undef pthread_cond_broadcast
1598 # if HAVE_RAW_DECL_PTHREAD_COND_BROADCAST
1599 _GL_WARN_ON_USE (pthread_cond_broadcast
, "pthread_cond_broadcast is not portable - "
1600 "use gnulib module pthread-cond for portability");
1604 #if @GNULIB_PTHREAD_COND@
1605 # if @REPLACE_PTHREAD_COND_DESTROY@
1606 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1607 # undef pthread_cond_destroy
1608 # define pthread_cond_destroy rpl_pthread_cond_destroy
1610 _GL_FUNCDECL_RPL (pthread_cond_destroy
, int, (pthread_cond_t
*cond
)
1611 _GL_ARG_NONNULL ((1)));
1612 _GL_CXXALIAS_RPL (pthread_cond_destroy
, int, (pthread_cond_t
*cond
));
1614 # if !@HAVE_PTHREAD_COND_DESTROY@
1615 _GL_FUNCDECL_SYS (pthread_cond_destroy
, int, (pthread_cond_t
*cond
)
1616 _GL_ARG_NONNULL ((1)));
1618 _GL_CXXALIAS_SYS (pthread_cond_destroy
, int, (pthread_cond_t
*cond
));
1620 _GL_CXXALIASWARN (pthread_cond_destroy
);
1621 #elif defined GNULIB_POSIXCHECK
1622 # undef pthread_cond_destroy
1623 # if HAVE_RAW_DECL_PTHREAD_COND_DESTROY
1624 _GL_WARN_ON_USE (pthread_cond_destroy
, "pthread_cond_destroy is not portable - "
1625 "use gnulib module pthread-cond for portability");
1629 /* =========== Thread-specific storage functions =========== */
1631 #if @GNULIB_PTHREAD_TSS@
1632 # if @REPLACE_PTHREAD_KEY_CREATE@
1633 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1634 # undef pthread_key_create
1635 # define pthread_key_create rpl_pthread_key_create
1637 _GL_FUNCDECL_RPL (pthread_key_create
, int,
1638 (pthread_key_t
*keyp
, void (*destructor
) (void *))
1639 _GL_ARG_NONNULL ((1)));
1640 _GL_CXXALIAS_RPL (pthread_key_create
, int,
1641 (pthread_key_t
*keyp
, void (*destructor
) (void *)));
1643 # if !@HAVE_PTHREAD_KEY_CREATE@
1644 _GL_FUNCDECL_SYS (pthread_key_create
, int,
1645 (pthread_key_t
*keyp
, void (*destructor
) (void *))
1646 _GL_ARG_NONNULL ((1)));
1648 _GL_CXXALIAS_SYS_CAST (pthread_key_create
, int,
1649 (pthread_key_t
*keyp
, void (*destructor
) (void *)));
1651 _GL_CXXALIASWARN (pthread_key_create
);
1652 #elif defined GNULIB_POSIXCHECK
1653 # undef pthread_key_create
1654 # if HAVE_RAW_DECL_PTHREAD_KEY_CREATE
1655 _GL_WARN_ON_USE (pthread_key_create
, "pthread_key_create is not portable - "
1656 "use gnulib module pthread-tss for portability");
1660 #if @GNULIB_PTHREAD_TSS@
1661 # if @REPLACE_PTHREAD_SETSPECIFIC@
1662 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1663 # undef pthread_setspecific
1664 # define pthread_setspecific rpl_pthread_setspecific
1666 _GL_FUNCDECL_RPL (pthread_setspecific
, int,
1667 (pthread_key_t key
, const void *value
));
1668 _GL_CXXALIAS_RPL (pthread_setspecific
, int,
1669 (pthread_key_t key
, const void *value
));
1671 # if !@HAVE_PTHREAD_SETSPECIFIC@
1672 _GL_FUNCDECL_SYS (pthread_setspecific
, int,
1673 (pthread_key_t key
, const void *value
));
1675 _GL_CXXALIAS_SYS (pthread_setspecific
, int,
1676 (pthread_key_t key
, const void *value
));
1678 _GL_CXXALIASWARN (pthread_setspecific
);
1679 #elif defined GNULIB_POSIXCHECK
1680 # undef pthread_setspecific
1681 # if HAVE_RAW_DECL_PTHREAD_SETSPECIFIC
1682 _GL_WARN_ON_USE (pthread_setspecific
, "pthread_setspecific is not portable - "
1683 "use gnulib module pthread-tss for portability");
1687 #if @GNULIB_PTHREAD_TSS@
1688 # if @REPLACE_PTHREAD_GETSPECIFIC@
1689 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1690 # undef pthread_getspecific
1691 # define pthread_getspecific rpl_pthread_getspecific
1693 _GL_FUNCDECL_RPL (pthread_getspecific
, void *, (pthread_key_t key
));
1694 _GL_CXXALIAS_RPL (pthread_getspecific
, void *, (pthread_key_t key
));
1696 # if !@HAVE_PTHREAD_GETSPECIFIC@
1697 _GL_FUNCDECL_SYS (pthread_getspecific
, void *, (pthread_key_t key
));
1699 _GL_CXXALIAS_SYS (pthread_getspecific
, void *, (pthread_key_t key
));
1701 _GL_CXXALIASWARN (pthread_getspecific
);
1702 #elif defined GNULIB_POSIXCHECK
1703 # undef pthread_getspecific
1704 # if HAVE_RAW_DECL_PTHREAD_GETSPECIFIC
1705 _GL_WARN_ON_USE (pthread_getspecific
, "pthread_getspecific is not portable - "
1706 "use gnulib module pthread-tss for portability");
1710 #if @GNULIB_PTHREAD_TSS@
1711 # if @REPLACE_PTHREAD_KEY_DELETE@
1712 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1713 # undef pthread_key_delete
1714 # define pthread_key_delete rpl_pthread_key_delete
1716 _GL_FUNCDECL_RPL (pthread_key_delete
, int, (pthread_key_t key
));
1717 _GL_CXXALIAS_RPL (pthread_key_delete
, int, (pthread_key_t key
));
1719 # if !@HAVE_PTHREAD_KEY_DELETE@
1720 _GL_FUNCDECL_SYS (pthread_key_delete
, int, (pthread_key_t key
));
1722 _GL_CXXALIAS_SYS (pthread_key_delete
, int, (pthread_key_t key
));
1724 _GL_CXXALIASWARN (pthread_key_delete
);
1725 #elif defined GNULIB_POSIXCHECK
1726 # undef pthread_key_delete
1727 # if HAVE_RAW_DECL_PTHREAD_KEY_DELETE
1728 _GL_WARN_ON_USE (pthread_key_delete
, "pthread_key_delete is not portable - "
1729 "use gnulib module pthread-tss for portability");
1733 /* =========== Spinlock functions =========== */
1735 #if @GNULIB_PTHREAD_SPIN@
1736 # if @REPLACE_PTHREAD_SPIN_INIT@
1737 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1738 # undef pthread_spin_init
1739 # define pthread_spin_init rpl_pthread_spin_init
1741 _GL_FUNCDECL_RPL (pthread_spin_init
, int,
1742 (pthread_spinlock_t
*lock
, int shared_across_processes
)
1743 _GL_ARG_NONNULL ((1)));
1744 _GL_CXXALIAS_RPL (pthread_spin_init
, int,
1745 (pthread_spinlock_t
*lock
, int shared_across_processes
));
1747 # if !@HAVE_PTHREAD_SPIN_INIT@
1748 _GL_FUNCDECL_SYS (pthread_spin_init
, int,
1749 (pthread_spinlock_t
*lock
, int shared_across_processes
)
1750 _GL_ARG_NONNULL ((1)));
1752 _GL_CXXALIAS_SYS (pthread_spin_init
, int,
1753 (pthread_spinlock_t
*lock
, int shared_across_processes
));
1756 _GL_CXXALIASWARN (pthread_spin_init
);
1758 #elif defined GNULIB_POSIXCHECK
1759 # undef pthread_spin_init
1760 # if HAVE_RAW_DECL_PTHREAD_SPIN_INIT
1761 _GL_WARN_ON_USE (pthread_spin_init
, "pthread_spin_init is not portable - "
1762 "use gnulib module pthread-spin for portability");
1766 #if @GNULIB_PTHREAD_SPIN@
1767 # if @REPLACE_PTHREAD_SPIN_LOCK@
1768 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1769 # undef pthread_spin_lock
1770 # define pthread_spin_lock rpl_pthread_spin_lock
1772 _GL_FUNCDECL_RPL (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
)
1773 _GL_ARG_NONNULL ((1)));
1774 _GL_CXXALIAS_RPL (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
));
1776 # if !@HAVE_PTHREAD_SPIN_LOCK@
1777 _GL_FUNCDECL_SYS (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
)
1778 _GL_ARG_NONNULL ((1)));
1780 _GL_CXXALIAS_SYS (pthread_spin_lock
, int, (pthread_spinlock_t
*lock
));
1783 _GL_CXXALIASWARN (pthread_spin_lock
);
1785 #elif defined GNULIB_POSIXCHECK
1786 # undef pthread_spin_lock
1787 # if HAVE_RAW_DECL_PTHREAD_SPIN_LOCK
1788 _GL_WARN_ON_USE (pthread_spin_lock
, "pthread_spin_lock is not portable - "
1789 "use gnulib module pthread-spin for portability");
1793 #if @GNULIB_PTHREAD_SPIN@
1794 # if @REPLACE_PTHREAD_SPIN_TRYLOCK@
1795 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1796 # undef pthread_spin_trylock
1797 # define pthread_spin_trylock rpl_pthread_spin_trylock
1799 _GL_FUNCDECL_RPL (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
)
1800 _GL_ARG_NONNULL ((1)));
1801 _GL_CXXALIAS_RPL (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
));
1803 # if !@HAVE_PTHREAD_SPIN_TRYLOCK@
1804 _GL_FUNCDECL_SYS (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
)
1805 _GL_ARG_NONNULL ((1)));
1807 _GL_CXXALIAS_SYS (pthread_spin_trylock
, int, (pthread_spinlock_t
*lock
));
1810 _GL_CXXALIASWARN (pthread_spin_trylock
);
1812 #elif defined GNULIB_POSIXCHECK
1813 # undef pthread_spin_trylock
1814 # if HAVE_RAW_DECL_PTHREAD_SPIN_TRYLOCK
1815 _GL_WARN_ON_USE (pthread_spin_trylock
, "pthread_spin_trylock is not portable - "
1816 "use gnulib module pthread-spin for portability");
1820 #if @GNULIB_PTHREAD_SPIN@
1821 # if @REPLACE_PTHREAD_SPIN_UNLOCK@
1822 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1823 # undef pthread_spin_unlock
1824 # define pthread_spin_unlock rpl_pthread_spin_unlock
1826 _GL_FUNCDECL_RPL (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
)
1827 _GL_ARG_NONNULL ((1)));
1828 _GL_CXXALIAS_RPL (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
));
1830 # if !@HAVE_PTHREAD_SPIN_UNLOCK@
1831 _GL_FUNCDECL_SYS (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
)
1832 _GL_ARG_NONNULL ((1)));
1834 _GL_CXXALIAS_SYS (pthread_spin_unlock
, int, (pthread_spinlock_t
*lock
));
1837 _GL_CXXALIASWARN (pthread_spin_unlock
);
1839 #elif defined GNULIB_POSIXCHECK
1840 # undef pthread_spin_unlock
1841 # if HAVE_RAW_DECL_PTHREAD_SPIN_UNLOCK
1842 _GL_WARN_ON_USE (pthread_spin_unlock
, "pthread_spin_unlock is not portable - "
1843 "use gnulib module pthread-spin for portability");
1847 #if @GNULIB_PTHREAD_SPIN@
1848 # if @REPLACE_PTHREAD_SPIN_DESTROY@
1849 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1850 # undef pthread_spin_destroy
1851 # define pthread_spin_destroy rpl_pthread_spin_destroy
1853 _GL_FUNCDECL_RPL (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
)
1854 _GL_ARG_NONNULL ((1)));
1855 _GL_CXXALIAS_RPL (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
));
1857 # if !@HAVE_PTHREAD_SPIN_DESTROY@
1858 _GL_FUNCDECL_SYS (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
)
1859 _GL_ARG_NONNULL ((1)));
1861 _GL_CXXALIAS_SYS (pthread_spin_destroy
, int, (pthread_spinlock_t
*lock
));
1864 _GL_CXXALIASWARN (pthread_spin_destroy
);
1866 #elif defined GNULIB_POSIXCHECK
1867 # undef pthread_spin_destroy
1868 # if HAVE_RAW_DECL_PTHREAD_SPIN_DESTROY
1869 _GL_WARN_ON_USE (pthread_spin_destroy
, "pthread_spin_destroy is not portable - "
1870 "use gnulib module pthread-spin for portability");
1875 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */
1876 #endif /* _@GUARD_PREFIX@_PTHREAD_H_ */