summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2019-02-21 22:08:35 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-02-21 22:09:45 +0100
commit4cc0d0f0c71e9949d41dad6ac101672560fa2df7 (patch)
treede58550d41e8b6e1a52a74ac5d626ab7dd21eabe
parentdae998374f7ffb7df3e41e6804380990c8aec5fb (diff)
Enable global signal distribution in htl
* sysdeps/mach/hurd/htl/pt-sigstate-init.c (__pthread_sigstate_init): Call _hurd_sigstate_set_global_rcv(). * sysdeps/mach/hurd/htl/pt-sigstate-destroy.c (__pthread_sigstate_destroy): Call _hurd_sigstate_delete(). * sysdeps/mach/hurd/htl/pt-sigstate.c: Include <hurd/msg.h> (__pthread_sigstate): Use _hurd_sigstate_lock()/_hurd_sigstate_unlock() and _hurd_sigstate_pending(). Call __msg_sig_post() to wake up thread with pending signals. * sysdeps/mach/hurd/Makefile (LDLIBS-pthread.so): Add $(objdir)/hurd/libhurduser.so.
-rw-r--r--.topmsg14
-rw-r--r--sysdeps/mach/hurd/Makefile2
-rw-r--r--sysdeps/mach/hurd/htl/pt-sigstate-destroy.c1
-rw-r--r--sysdeps/mach/hurd/htl/pt-sigstate-init.c2
-rw-r--r--sysdeps/mach/hurd/htl/pt-sigstate.c12
5 files changed, 25 insertions, 6 deletions
diff --git a/.topmsg b/.topmsg
index 97ec55c306..5e70e59e0e 100644
--- a/.topmsg
+++ b/.topmsg
@@ -1,6 +1,14 @@
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
-Subject: [PATCH] t/libpthread_sigs
+Subject: Enable global signal distribution in htl
-<patch description>
+* sysdeps/mach/hurd/htl/pt-sigstate-init.c (__pthread_sigstate_init):
+Call _hurd_sigstate_set_global_rcv().
+* sysdeps/mach/hurd/htl/pt-sigstate-destroy.c
+(__pthread_sigstate_destroy): Call _hurd_sigstate_delete().
+* sysdeps/mach/hurd/htl/pt-sigstate.c: Include <hurd/msg.h>
+(__pthread_sigstate): Use _hurd_sigstate_lock()/_hurd_sigstate_unlock()
+and _hurd_sigstate_pending(). Call __msg_sig_post() to wake up thread
+with pending signals.
+* sysdeps/mach/hurd/Makefile (LDLIBS-pthread.so): Add
+$(objdir)/hurd/libhurduser.so.
-Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index 3a853a6cd9..8a865a0e1f 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -206,4 +206,6 @@ ifeq ($(subdir),nis)
CFLAGS-ypclnt.c += -DUSE_BINDINGDIR=1
endif
+LDLIBS-pthread.so += $(objdir)/hurd/libhurduser.so
+
endif # in-Makerules
diff --git a/sysdeps/mach/hurd/htl/pt-sigstate-destroy.c b/sysdeps/mach/hurd/htl/pt-sigstate-destroy.c
index e7154a371d..229a415487 100644
--- a/sysdeps/mach/hurd/htl/pt-sigstate-destroy.c
+++ b/sysdeps/mach/hurd/htl/pt-sigstate-destroy.c
@@ -23,4 +23,5 @@
void
__pthread_sigstate_destroy (struct __pthread *thread)
{
+ _hurd_sigstate_delete (thread->kernel_thread);
}
diff --git a/sysdeps/mach/hurd/htl/pt-sigstate-init.c b/sysdeps/mach/hurd/htl/pt-sigstate-init.c
index 70832f9576..507fb8ade2 100644
--- a/sysdeps/mach/hurd/htl/pt-sigstate-init.c
+++ b/sysdeps/mach/hurd/htl/pt-sigstate-init.c
@@ -35,7 +35,7 @@ __pthread_sigstate_init (struct __pthread *thread)
if (do_init_global)
{
struct hurd_sigstate *ss = _hurd_thread_sigstate (thread->kernel_thread);
- (void) ss;
+ _hurd_sigstate_set_global_rcv (ss);
}
else if (__pthread_num_threads >= 2)
do_init_global = 1;
diff --git a/sysdeps/mach/hurd/htl/pt-sigstate.c b/sysdeps/mach/hurd/htl/pt-sigstate.c
index f7050ec0df..2ddceb229e 100644
--- a/sysdeps/mach/hurd/htl/pt-sigstate.c
+++ b/sysdeps/mach/hurd/htl/pt-sigstate.c
@@ -20,6 +20,7 @@
#include <assert.h>
#include <signal.h>
#include <hurd/signal.h>
+#include <hurd/msg.h>
#include <pt-internal.h>
@@ -29,11 +30,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);
- __spin_lock (&ss->lock);
+ _hurd_sigstate_lock (ss);
if (oset != NULL)
*oset = ss->blocked;
@@ -64,7 +66,13 @@ __pthread_sigstate (struct __pthread *thread, int how,
if (!err && clear_pending)
__sigemptyset (&ss->pending);
- __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;
}