diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2021-08-06 14:10:30 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2021-08-06 14:10:30 +0900 |
commit | 67595e8244ed67910f7372873cdbf674c2e85403 (patch) | |
tree | f96d1595c4a9337aae97fbee91676bc849e9cf12 | |
parent | 8538a83fd1b5e54d7dbe6dc9042cc74942e38e51 (diff) | |
download | libgpg-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>
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/posix-lock.c | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 23a664e..da013d8 100644 --- a/configure.ac +++ b/configure.ac @@ -477,6 +477,7 @@ else if test "$gl_threads_api" = posix; then AC_CHECK_SIZEOF(pthread_mutex_t,,[AC_INCLUDES_DEFAULT #include <pthread.h>]) + AC_CHECK_HEADERS([sys/single_threaded.h]) fi fi 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*/ |