summaryrefslogtreecommitdiff
path: root/sysdeps/mach
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2015-05-06 21:37:32 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2015-05-06 23:35:43 +0000
commit05a3bc04ff90fcbea9275f56a6cf5a983a88d00f (patch)
treea4dbcf46dcb39721d8fc6f82917da5626717c17a /sysdeps/mach
parent9aa597d0457d265b9bbdc213de67a8ce9e30f60a (diff)
Wake up the message thread when pending signals have been unblocked
(code grabbed from glibc) * libpthread/sysdeps/mach/hurd/pt-sigstate.c: Include <hurd/msg.h> (__pthread_sigstate): Use _hurd_sigstate_lock/unlock instead of __pthread_spin_lock on `ss->lock'. Check _hurd_sigstate_pending and send a message to the signal thread if needed.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/pt-sigstate.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/pt-sigstate.c b/sysdeps/mach/hurd/pt-sigstate.c
index 68c79c5..2af3e39 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,11 +32,12 @@ __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);
- __pthread_spin_lock (&ss->lock);
+ _hurd_sigstate_lock (ss);
if (oset)
*oset = ss->blocked;
@@ -63,7 +65,13 @@ __pthread_sigstate (struct __pthread *thread, int how,
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;
}