Enable global signal distribution in htl
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Tue, 4 Feb 2020 19:37:26 +0000 (19:37 +0000)
committerAurelien Jarno <aurel32@debian.org>
Tue, 4 Feb 2020 19:37:26 +0000 (19:37 +0000)
* 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.

Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name libpthread_sigs.diff

sysdeps/mach/hurd/Makefile
sysdeps/mach/hurd/htl/pt-sigstate-destroy.c
sysdeps/mach/hurd/htl/pt-sigstate-init.c
sysdeps/mach/hurd/htl/pt-sigstate.c

index 8e2dff7de43cbe6ff3ab301aa6be1b346d370e0c..714bdddbe5a8dc6510fb1a54d9c2d5b436f1340f 100644 (file)
@@ -211,4 +211,6 @@ ifeq ($(subdir),nis)
 CFLAGS-ypclnt.c += -DUSE_BINDINGDIR=1
 endif
 
+LDLIBS-pthread.so += $(objdir)/hurd/libhurduser.so
+
 endif  # in-Makerules
index 13499c35871cdb00bc107441ce67c1c70ecd555c..3c9147bc61de524deeca579a49816c857dcb9da0 100644 (file)
@@ -23,4 +23,5 @@
 void
 __pthread_sigstate_destroy (struct __pthread *thread)
 {
+  _hurd_sigstate_delete (thread->kernel_thread);
 }
index ecf3f71d1a7810673199291dafd21474bfa43bf9..c4fafae53ce4b4f0cc1c066e1e100563b968e22b 100644 (file)
@@ -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;
index 8408a4514a20f8830fad820a25199f4dc440875a..d5f6bc84c329915c6a5603b28da99b96f7565073 100644 (file)
@@ -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;
 }