summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-08-06 14:10:30 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2021-08-06 14:10:30 +0900
commit67595e8244ed67910f7372873cdbf674c2e85403 (patch)
treef96d1595c4a9337aae97fbee91676bc849e9cf12 /src
parent8538a83fd1b5e54d7dbe6dc9042cc74942e38e51 (diff)
downloadlibgpg-error-67595e8244ed67910f7372873cdbf674c2e85403.tar.gz
posix-lock: Support GNU C library 2.34 or later.
* configure.ac: Add check for sys/single_threaded.h. * src/posix-lock.c [USE_POSIX_THREADS_FROM_LIBC]: Use __libc_single_threaded to detect if it's single threaded. -- GnuPG-bug-id: 5547 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'src')
-rw-r--r--src/posix-lock.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/posix-lock.c b/src/posix-lock.c
index be4cc27..d0fd07a 100644
--- a/src/posix-lock.c
+++ b/src/posix-lock.c
@@ -44,7 +44,10 @@
#if USE_POSIX_THREADS
-# if USE_POSIX_THREADS_WEAK
+# if USE_POSIX_THREADS_FROM_LIBC && HAVE_SYS_SINGLE_THREADED_H
+# include <sys/single_threaded.h>
+# define use_pthread_p() !__libc_single_threaded
+# elif USE_POSIX_THREADS_WEAK
/* On ELF systems it is easy to use pthreads using weak
references. Take care not to test the address of a weak
referenced function we actually use; some GCC versions have a
@@ -99,7 +102,7 @@ use_pthread_p (void)
}
return result;
}
-#endif /*PTHREAD_IN_USE_DETECTION_HARD*/
+# endif /*PTHREAD_IN_USE_DETECTION_HARD*/
#endif /*USE_POSIX_THREADS*/