ruby-changes:52194
From: nobu <ko1@a...>
Date: Fri, 17 Aug 2018 10:39:52 +0900 (JST)
Subject: [ruby-changes:52194] nobu:r64402 (trunk): signal.c: no SIGCHLD, no sigchld_hit
nobu 2018-08-17 10:39:49 +0900 (Fri, 17 Aug 2018) New Revision: 64402 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64402 Log: signal.c: no SIGCHLD, no sigchld_hit * signal.c (sigchld_hit): if SIGCHLD is not available, this variable never sets. Modified files: trunk/signal.c Index: signal.c =================================================================== --- signal.c (revision 64401) +++ signal.c (revision 64402) @@ -707,7 +707,13 @@ signal_enque(int sig) https://github.com/ruby/ruby/blob/trunk/signal.c#L707 ATOMIC_INC(signal_buff.size); } +#if RUBY_SIGCHLD static rb_atomic_t sigchld_hit; +/* destructive getter than simple predicate */ +# define GET_SIGCHLD_HIT() ATOMIC_EXCHANGE(sigchld_hit, 0) +#else +# define GET_SIGCHLD_HIT() 0 +#endif static RETSIGTYPE sighandler(int sig) @@ -716,6 +722,7 @@ sighandler(int sig) https://github.com/ruby/ruby/blob/trunk/signal.c#L722 /* the VM always needs to handle SIGCHLD for rb_waitpid */ if (sig == RUBY_SIGCHLD) { +#if RUBY_SIGCHLD rb_vm_t *vm = GET_VM(); ATOMIC_EXCHANGE(sigchld_hit, 1); @@ -723,6 +730,7 @@ sighandler(int sig) https://github.com/ruby/ruby/blob/trunk/signal.c#L730 if (vm && ACCESS_ONCE(VALUE, vm->trap_list.cmd[sig])) { signal_enque(sig); } +#endif } else { signal_enque(sig); @@ -1076,7 +1084,7 @@ void ruby_waitpid_all(rb_vm_t *); /* pro https://github.com/ruby/ruby/blob/trunk/signal.c#L1084 void ruby_sigchld_handler(rb_vm_t *vm) { - if (SIGCHLD_LOSSY || ATOMIC_EXCHANGE(sigchld_hit, 0)) { + if (SIGCHLD_LOSSY || GET_SIGCHLD_HIT()) { ruby_waitpid_all(vm); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/