summaryrefslogtreecommitdiff
path: root/debian/patches/libpthread_sigmask.patch
blob: 71aaf2ad585e96266021455db9bdfcd70443417c (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
48
* 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).

Will be replaced by proper global signal support from Jeremie
---
 libpthread/sysdeps/mach/hurd/pt-sigstate.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/libpthread/sysdeps/mach/hurd/pt-sigstate.c b/libpthread/sysdeps/mach/hurd/pt-sigstate.c
index 68c79c5..51263ac 100644
--- a/libpthread/sysdeps/mach/hurd/pt-sigstate.c
+++ b/libpthread/sysdeps/mach/hurd/pt-sigstate.c
@@ -21,6 +21,7 @@
 #include <assert.h>
 #include <signal.h>
 #include <hurd/signal.h>
+#include <hurd/msg.h>
 
 #include <pt-internal.h>
 
@@ -31,6 +32,7 @@ __pthread_sigstate (struct __pthread *thread, int how,
 {
   error_t err = 0;
   struct hurd_sigstate *ss;
+  sigset_t pending;
 
   ss = _hurd_thread_sigstate (thread->kernel_thread);
   assert (ss);
@@ -63,7 +65,14 @@ __pthread_sigstate (struct __pthread *thread, int how,
   if (! err && clear_pending)
     __sigemptyset (&ss->pending);
 
+  pending = ss->pending & ~ss->blocked;
+
   __pthread_spin_unlock (&ss->lock);
 
+  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;
 }
-- 
1.7.1