summaryrefslogtreecommitdiff
path: root/debian/patches/libpthread_sigmask.patch
blob: 7315a80d3420377d02fa29bd18572641cbeb711c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
* libpthread/sysdeps/mach/hurd/pt-sigstate.c (__pthread_sigstate): Wake up the message
thread if any pending signals have been unblocked (code grabbed from glibc).
---
 libpthread/sysdeps/mach/hurd/pt-sigstate.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

Index: hurd/libpthread/sysdeps/mach/hurd/pt-sigstate.c
===================================================================
--- hurd.orig/libpthread/sysdeps/mach/hurd/pt-sigstate.c	2011-05-29 15:23:30.000000000 +0000
+++ hurd/libpthread/sysdeps/mach/hurd/pt-sigstate.c	2011-06-10 04:53:53.000000000 +0000
@@ -21,6 +21,7 @@
 #include <assert.h>
 #include <signal.h>
 #include <hurd/signal.h>
+#include <hurd/msg.h>
 
 #include <pt-internal.h>
 
@@ -31,11 +32,12 @@
 {
   error_t err = 0;
   struct hurd_sigstate *ss;
+  sigset_t pending;
 
   ss = _hurd_thread_sigstate (thread->kernel_thread);
   assert (ss);
 
-  __pthread_spin_lock (&ss->lock);
+  _hurd_sigstate_lock (ss);
 
   if (oset)
     *oset = ss->blocked;
@@ -63,7 +65,13 @@
   if (! err && clear_pending)
     __sigemptyset (&ss->pending);
 
-  __pthread_spin_unlock (&ss->lock);
+  pending = _hurd_sigstate_pending (ss) & ~ss->blocked;
+  _hurd_sigstate_unlock (ss);
+
+  if (! err && pending)
+    /* Send a message to the signal thread so it
+       will wake up and check for pending signals.  */
+    __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
 
   return err;
 }