From 1658e7d96696a656d9bd0a0c84c82cde86914ba2 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Thu, 9 Mar 2023 16:05:47 +1300 Subject: Remove SIGCHLD `waidpid`. (#7476) * Remove `waitpid_lock` and related code. * Remove un-necessary test. * Remove `rb_thread_sleep_interruptible` dead code. --- signal.c | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) (limited to 'signal.c') diff --git a/signal.c b/signal.c index 544854e014..b7a8dbe4dd 100644 --- a/signal.c +++ b/signal.c @@ -1085,16 +1085,6 @@ rb_vm_trap_exit(rb_vm_t *vm) } } -void ruby_waitpid_all(rb_vm_t *); /* process.c */ - -void -ruby_sigchld_handler(rb_vm_t *vm) -{ - if (SIGCHLD_LOSSY || GET_SIGCHLD_HIT()) { - ruby_waitpid_all(vm); - } -} - /* returns true if a trap handler was run, false otherwise */ int rb_signal_exec(rb_thread_t *th, int sig) @@ -1623,33 +1613,5 @@ fake_grantfd(int masterfd) int rb_grantpt(int masterfd) { - if (RUBY_SIGCHLD) { - rb_vm_t *vm = GET_VM(); - int ret, e; - - /* - * Prevent waitpid calls from Ruby by taking waitpid_lock. - * Pedantically, grantpt(3) is undefined if a non-default - * SIGCHLD handler is defined, but preventing conflicting - * waitpid calls ought to be sufficient. - * - * We could install the default sighandler temporarily, but that - * could cause SIGCHLD to be missed by other threads. Blocking - * SIGCHLD won't work here, either, unless we stop and restart - * timer-thread (as only timer-thread sees SIGCHLD), but that - * seems like overkill. - */ - rb_nativethread_lock_lock(&vm->waitpid_lock); - { - ret = grantpt(masterfd); /* may spawn `pt_chown' and wait on it */ - if (ret < 0) e = errno; - } - rb_nativethread_lock_unlock(&vm->waitpid_lock); - - if (ret < 0) errno = e; - return ret; - } - else { - return grantpt(masterfd); - } + return grantpt(masterfd); } -- cgit v1.2.3