summaryrefslogtreecommitdiff
path: root/debian/patches/libpthread_globsigdisp.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/libpthread_globsigdisp.patch')
-rw-r--r--debian/patches/libpthread_globsigdisp.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/debian/patches/libpthread_globsigdisp.patch b/debian/patches/libpthread_globsigdisp.patch
new file mode 100644
index 00000000..06c3486c
--- /dev/null
+++ b/debian/patches/libpthread_globsigdisp.patch
@@ -0,0 +1,59 @@
+commit 60d1b9b9198bc8c618596cb0e48687bd41e8adb7
+Author: Jeremie Koenig <jk@jk.fr.eu.org>
+Date: Fri Jun 10 05:46:39 2011 +0000
+
+ Mark new threads as global signal receivers
+
+ * sysdeps/mach/hurd/pt-sigstate-init.c (__pthread_sigstate_init):
+ Call _hurd_sigstate_set_global_rcv for newly created threads.
+ * sysdeps/mach/pt-thread-halt.c (__pthread_thread_halt):
+ Call _hurd_sigstate_delete on terminated threads.
+
+diff --git a/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c b/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c
+index da5a945..f8398f4 100644
+--- a/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c
++++ b/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c
+@@ -19,6 +19,7 @@
+
+ #include <pthread.h>
+ #include <hurd/threadvar.h>
++#include <hurd/signal.h>
+
+ #include <pt-internal.h>
+
+@@ -30,8 +31,21 @@ __pthread_sigstate_init (struct __pthread *thread)
+ thread->stackaddr);
+
+ /* The real initialization happens internally in glibc the first
+- time that _hurd_thead_sigstate is called. */
++ time that _hurd_self_sigstate is called. */
+ *location = 0;
+
++ /* Mark the thread as a global signal receiver so as to conform with
++ the pthread semantics. However, we must be careful. The first
++ pthread created is the main thread, during libpthread initialization.
++ We must not mark it, otherwise the sigprocmask call in
++ __pthread_create would try to access _hurd_global_sigstate,
++ which is not initialized yet. When glibc runs _hurdsig_init later
++ on, the message thread is created, which must not be marked either. */
++ if (__pthread_num_threads > 2)
++ {
++ struct hurd_sigstate *ss = _hurd_thread_sigstate (thread->kernel_thread);
++ _hurd_sigstate_set_global_rcv (ss);
++ }
++
+ return 0;
+ }
+diff --git a/libpthread/sysdeps/mach/pt-thread-halt.c b/libpthread/sysdeps/mach/pt-thread-halt.c
+index a9c3858..808043d 100644
+--- a/libpthread/sysdeps/mach/pt-thread-halt.c
++++ b/libpthread/sysdeps/mach/pt-thread-halt.c
+@@ -34,6 +34,8 @@ __pthread_thread_halt (struct __pthread *thread)
+ {
+ if (thread->have_kernel_resources)
+ {
++ _hurd_sigstate_delete (thread->kernel_thread);
++
+ if (thread == _pthread_self ())
+ {
+ while (1)