mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Use a global SIGCHLD handler to guard all callers of rb_waitpid. To work safely with multi-threaded programs, we introduce a VM-wide waitpid_lock to be acquired BEFORE fork/vfork spawns the process. This is to be combined with the new ruby_waitpid_locked function used by mjit.c in a non-Ruby thread. Ruby-level SIGCHLD handlers registered with Signal.trap(:CHLD) continues to work as before and there should be no regressions in any existing use cases. Splitting the wait queues for PID > 0 and groups (PID <= 0) ensures we favor PID > 0 callers. The disabling of SIGCHLD in rb_f_system is longer necessary, as we use deferred signal handling and no longer make ANY blocking waitpid syscalls in other threads which could "beat" the waitpid call made by rb_f_system. We prevent SIGCHLD from firing in normal Ruby Threads and only enable it in the timer-thread, to prevent spurious wakeups from in test/-ext-/gvl/test_last_thread.rb with MJIT enabled. I've tried to guard as much of the code for RUBY_SIGCHLD==0 using C "if" statements rather than CPP "#if" so to reduce the likelyhood of portability problems as the compiler will see more code. We also work to suppress false-positives from Process.wait(-1, Process::WNOHANG) to quiets warnings from spec/ruby/core/process/wait2_spec.rb with MJIT enabled. Lastly, we must implement rb_grantpt for ext/pty. We need a MJIT-compatible way of supporting grantpt(3) which may spawn the `pt_chown' binary and call waitpid(2) on it. [ruby-core:87605] [Ruby trunk Bug#14867] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e |
||
|---|---|---|
| .. | ||
| -test- | ||
| bigdecimal | ||
| cgi/escape | ||
| continuation | ||
| coverage | ||
| date | ||
| dbm | ||
| digest | ||
| etc | ||
| fcntl | ||
| fiber | ||
| fiddle | ||
| gdbm | ||
| io | ||
| json | ||
| nkf | ||
| objspace | ||
| openssl | ||
| pathname | ||
| psych | ||
| pty | ||
| racc/cparse | ||
| rbconfig/sizeof | ||
| readline | ||
| ripper | ||
| rubyvm | ||
| sdbm | ||
| socket | ||
| stringio | ||
| strscan | ||
| syslog | ||
| win32 | ||
| win32ole | ||
| zlib | ||
| .document | ||
| extmk.rb | ||
| Setup | ||
| Setup.atheos | ||
| Setup.nt | ||