mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
signal.c: no SIGCHLD, no sigchld_hit
* signal.c (sigchld_hit): if SIGCHLD is not available, this variable never sets. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e01afc3c8e
commit
028cda35c7
1 changed files with 9 additions and 1 deletions
10
signal.c
10
signal.c
|
@ -707,7 +707,13 @@ signal_enque(int sig)
|
|||
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)
|
|||
|
||||
/* 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)
|
|||
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 *); /* process.c */
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue