public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: libc-alpha@sourceware.org
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Subject: [hurd,commited] hurd: avoid letting signals go to thread created by timer_create
Date: Fri, 30 Mar 2018 00:48:00 -0000	[thread overview]
Message-ID: <20180330004801.30963-1-samuel.thibault@ens-lyon.org> (raw)

* sysdeps/pthread/timer_routines.c (__timer_thread_start): Block all
signals in thread created for runing timers.
---
 ChangeLog                        | 5 +++++
 sysdeps/pthread/timer_routines.c | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 1f9842518a..5bee19c60f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-03-30  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* sysdeps/pthread/timer_routines.c (__timer_thread_start): Block all
+	signals in thread created for runing timers.
+
 2018-03-29  Florian Weimer  <fweimer@redhat.com>
 
 	* sysdeps/unix/sysv/linux/i386/tst-bz21269.c (do_test): Also
diff --git a/sysdeps/pthread/timer_routines.c b/sysdeps/pthread/timer_routines.c
index e6e884f53e..25ccfadd7e 100644
--- a/sysdeps/pthread/timer_routines.c
+++ b/sysdeps/pthread/timer_routines.c
@@ -463,10 +463,14 @@ int
 __timer_thread_start (struct thread_node *thread)
 {
   int retval = 1;
+  sigset_t set, oset;
 
   assert (!thread->exists);
   thread->exists = 1;
 
+  sigfillset (&set);
+  pthread_sigmask (SIG_SETMASK, &set, &oset);
+
   if (pthread_create (&thread->id, &thread->attr,
 		      (void *(*) (void *)) thread_func, thread) != 0)
     {
@@ -474,6 +478,8 @@ __timer_thread_start (struct thread_node *thread)
       retval = -1;
     }
 
+  pthread_sigmask (SIG_SETMASK, &oset, NULL);
+
   return retval;
 }
 
-- 
2.16.2

                 reply	other threads:[~2018-03-30  0:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180330004801.30963-1-samuel.thibault@ens-lyon.org \
    --to=samuel.thibault@ens-lyon.org \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).