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