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=-3.9 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 4C8DE1F597 for ; Tue, 26 Jun 2018 09:38:17 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH 00/14] SIGCHLD hijack for waitpid Date: Tue, 26 Jun 2018 09:38:03 +0000 Message-Id: <20180626093817.1533-1-e@80x24.org> List-Id: * Implemented rb_grantpt for ext/pty use (to temporarily disable SIGCHLD) * reinstated non-SIGCHLD code path for rb_waitpid * split Process.wait(PID > 0) and Process.wait(PID <= 0) threads to prioritize (PID > 0) waiters. This was an important change. * avoid spurious wakeups in main thread if no trap(:CHLD) users (needed to get OpenSSL::PKey::RSA.new working with rubygems test and test/-ext-/gvl/test_last_thread.rb to pass on Linux) In retrospect, we could probably be avoiding spurious main thread wakeups for all signals when nobody registers trap(sig). However, this isn't effective on FreeBSD... We may need to block non-VTALRM signals in main thread, and only enable interrupts in tiner-thread. The actual history is a mess, will need to cleanup and do more documenting before committing. MJIT takes forever to test :< I am happy that ext/pty/pty.c is cleaner with the rb_grantpt change, now :) The following changes since commit 4444025d16ae1a586eee6a0ac9bdd09e33833f3c: mjit_compile.inc.erb: drop unnecessary variable (2018-06-25 14:15:26 +0000) are available in the Git repository at: git://80x24.org/ruby.git mjit-chld-wip for you to fetch changes up to 6545efeee931baa42f38d9b86941c0e5d30c1044: process.c (rb_waitpid): reimplement non-SIGCHLD code path (2018-06-26 09:09:21 +0000) ---------------------------------------------------------------- Eric Wong (14): hijack SIGCHLD handler for internal use fix SIGCHLD hijacking race conditions mjit.c: allow working on platforms without SIGCHLD cleanups handle SIGCHLD in both the timer-thread and main thread Revert "test_process.rb: skip tests for Bug 14867" Revert "spec: skip Process wait specs on MJIT" wip testing pgrp list grantpt blocking mjit_finish reinitialize waitpid_lock signal.c: prevent spurious wakeup of main thread for SIGCHLD process.c (rb_waitpid): reimplement non-SIGCHLD code path configure.ac | 1 + ext/pty/pty.c | 22 +-- internal.h | 3 + mjit.c | 47 ++++-- process.c | 261 +++++++++++++++++++++++++++------ signal.c | 119 +++++++++++---- spec/mspec/lib/mspec/guards/feature.rb | 6 - spec/ruby/core/process/wait2_spec.rb | 26 ++-- spec/ruby/core/process/wait_spec.rb | 122 ++++++++------- spec/ruby/core/process/waitall_spec.rb | 67 +++++---- test/ruby/test_process.rb | 3 - thread.c | 34 +++++ thread_pthread.c | 18 +++ vm_core.h | 13 ++ 14 files changed, 525 insertions(+), 217 deletions(-) -- EW