From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B39EF1F516; Tue, 26 Jun 2018 10:51:29 +0000 (UTC) Date: Tue, 26 Jun 2018 10:51:28 +0000 From: Eric Wong To: spew@80x24.org Subject: [PATCH 15/14] force SIGCHLD to the timer-thread Message-ID: <20180626105128.GA48055@ailurophile> References: <20180626093817.1533-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180626093817.1533-1-e@80x24.org> List-Id: 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