summaryrefslogtreecommitdiff
path: root/tests/pthread.in.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-24 08:54:48 +0100
commit163a663518f33bab48b28431972e580b366b4d49 (patch)
treef518ffabaca4a0b93f0103d617e803792d3b0b43 /tests/pthread.in.h
parent1b3a8d5ad2ea2f099d514d9dd51ebf926a628076 (diff)
parentdd0000f7e25abe6c28d4329d324fd7fcab54094f (diff)
Merge branch 'release/debian/1.2-1'HEADdebian/1.2-1master
Diffstat (limited to 'tests/pthread.in.h')
-rw-r--r--tests/pthread.in.h24
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;