From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH 15/14] force SIGCHLD to the timer-thread
Date: Tue, 26 Jun 2018 10:51:28 +0000 [thread overview]
Message-ID: <20180626105128.GA48055@ailurophile> (raw)
In-Reply-To: <20180626093817.1533-1-e@80x24.org>
This is needed to prevent spurious wakeup on FreeBSD 11.1
to pass test/-ext-/gvl/test_last_thread.rb
---
signal.c | 1 +
thread_pthread.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/signal.c b/signal.c
index 90d7824b2b..1f8e26340f 100644
--- a/signal.c
+++ b/signal.c
@@ -749,6 +749,7 @@ rb_enable_interrupt(void)
#ifdef HAVE_PTHREAD_SIGMASK
sigset_t mask;
sigemptyset(&mask);
+ sigaddset(&mask, RUBY_SIGCHLD); /* timer-thread handles this */
pthread_sigmask(SIG_SETMASK, &mask, NULL);
#endif
}
diff --git a/thread_pthread.c b/thread_pthread.c
index 4053a22eac..6ac7728ad9 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1479,6 +1479,13 @@ static void *
thread_timer(void *p)
{
rb_global_vm_lock_t *gvl = (rb_global_vm_lock_t *)p;
+#ifdef HAVE_PTHREAD_SIGMASK /* mainly to enable SIGCHLD */
+ {
+ sigset_t mask;
+ sigemptyset(&mask);
+ pthread_sigmask(SIG_SETMASK, &mask, NULL);
+ }
+#endif
if (TT_DEBUG) WRITE_CONST(2, "start timer thread\n");
--
EW
prev parent reply other threads:[~2018-06-26 10:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-26 9:38 [PATCH 00/14] SIGCHLD hijack for waitpid Eric Wong
2018-06-26 9:38 ` [PATCH 01/14] hijack SIGCHLD handler for internal use Eric Wong
2018-06-26 9:38 ` [PATCH 02/14] fix SIGCHLD hijacking race conditions Eric Wong
2018-06-26 9:38 ` [PATCH 03/14] mjit.c: allow working on platforms without SIGCHLD Eric Wong
2018-06-26 9:38 ` [PATCH 04/14] cleanups Eric Wong
2018-06-26 9:38 ` [PATCH 05/14] handle SIGCHLD in both the timer-thread and main thread Eric Wong
2018-06-26 9:38 ` [PATCH 06/14] Revert "test_process.rb: skip tests for Bug 14867" Eric Wong
2018-06-26 9:38 ` [PATCH 07/14] Revert "spec: skip Process wait specs on MJIT" Eric Wong
2018-06-26 9:38 ` [PATCH 08/14] wip testing Eric Wong
2018-06-26 9:38 ` [PATCH 09/14] pgrp list Eric Wong
2018-06-26 9:38 ` [PATCH 10/14] grantpt Eric Wong
2018-06-26 9:38 ` [PATCH 11/14] blocking mjit_finish Eric Wong
2018-06-26 9:38 ` [PATCH 12/14] reinitialize waitpid_lock Eric Wong
2018-06-26 9:38 ` [PATCH 13/14] signal.c: prevent spurious wakeup of main thread for SIGCHLD Eric Wong
2018-06-26 9:38 ` [PATCH 14/14] process.c (rb_waitpid): reimplement non-SIGCHLD code path Eric Wong
2018-06-26 10:51 ` Eric Wong [this message]
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=20180626105128.GA48055@ailurophile \
--to=e@80x24.org \
--cc=spew@80x24.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).