bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Deliver pending signals unblocked by pthread_sigmask.


From: Jeremie Koenig
Subject: [PATCH] Deliver pending signals unblocked by pthread_sigmask.
Date: Fri, 3 Sep 2010 01:38:29 +0200

* sysdeps/mach/hurd/pt-sigstate.c (__pthread_sigstate): Wake up the message
thread if any pending signals have been unblocked (code grabbed from glibc).
---
 sysdeps/mach/hurd/pt-sigstate.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/sysdeps/mach/hurd/pt-sigstate.c b/sysdeps/mach/hurd/pt-sigstate.c
index 68c79c5..51263ac 100644
--- a/sysdeps/mach/hurd/pt-sigstate.c
+++ b/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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]