diff options
Diffstat (limited to 'tests/pthread.in.h')
-rw-r--r-- | tests/pthread.in.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/pthread.in.h b/tests/pthread.in.h index cf9ca3a4..cd705fbd 100644 --- a/tests/pthread.in.h +++ b/tests/pthread.in.h @@ -1,6 +1,6 @@ /* Implement the most essential subset of POSIX 1003.1-2008 pthread.h. - Copyright (C) 2009-2022 Free Software Foundation, Inc. + Copyright (C) 2009-2024 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -51,6 +51,12 @@ #ifndef _@GUARD_PREFIX@_PTHREAD_H_ #define _@GUARD_PREFIX@_PTHREAD_H_ +/* This file uses _Noreturn, _GL_ATTRIBUTE_PURE, GNULIB_POSIXCHECK, + HAVE_RAW_DECL_*. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #define __need_system_stdlib_h #include <stdlib.h> #undef __need_system_stdlib_h @@ -409,7 +415,21 @@ typedef pthread_mutex_t pthread_spinlock_t; # define PTHREAD_PROCESS_PRIVATE 0 # define PTHREAD_PROCESS_SHARED 1 #else -# if !@HAVE_PTHREAD_SPINLOCK_T@ +# if @HAVE_PTHREAD_SPINLOCK_T@ +/* <pthread.h> exists and defines pthread_spinlock_t. */ +# if !(((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \ + || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) \ + || (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \ + && !defined __ANDROID__) \ + || __clang_major__ >= 3)) \ + && !defined __ibmxl__) +/* We can't use GCC built-ins. Approximate spinlocks with mutexes. */ +# if !GNULIB_defined_pthread_spin_types +# define pthread_spinlock_t pthread_mutex_t +# define GNULIB_defined_pthread_spin_types 1 +# endif +# endif +# else /* Approximate spinlocks with mutexes. */ # if !GNULIB_defined_pthread_spin_types typedef pthread_mutex_t pthread_spinlock_t; |