>From 50a86dd7c0a447468043aec0d147818d67a8a816 Mon Sep 17 00:00:00 2001
Message-ID: <50a86dd7c0a447468043aec0d147818d67a8a816.1787799007.git.gniibe@fsij.org>
From: NIIBE Yutaka <gniibe@fsij.org>
Date: Thu, 27 Aug 2026 11:40:26 +0900
Subject: [PATCH Libgpg-error] Fix use_pthread_p for GNU Hurd.
To: gnupg-devel@gnupg.org
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.47.3"

This is a multi-part message in MIME format.
--------------2.47.3
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


* src/posix-lock.c: [__gnu_hurd__] (use_pthread_p): Implement for
GNU Hurd.

--

Hurd uses an internal thread for handling signals, and
__libc_single_threaded is zero.  We need to examine __pthread_total
instead.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
---
 src/posix-lock.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


--------------2.47.3
Content-Type: text/x-patch; name="0001-Fix-use_pthread_p-for-GNU-Hurd.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Fix-use_pthread_p-for-GNU-Hurd.patch"

diff --git a/src/posix-lock.c b/src/posix-lock.c
index 85ec660..e2dd826 100644
--- a/src/posix-lock.c
+++ b/src/posix-lock.c
@@ -44,7 +44,10 @@
 
 
 #if USE_POSIX_THREADS
-# if USE_POSIX_THREADS_FROM_LIBC && HAVE_SYS_SINGLE_THREADED_H
+# ifdef __gnu_hurd__
+extern unsigned int __pthread_total;
+#  define use_pthread_p() (__pthread_total > 1)
+# elif 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

--------------2.47.3--


