mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Remove SIGCHLD waidpid
. (#7527)
* Remove `waitpid_lock` and related code. * Remove un-necessary test. * Remove `rb_thread_sleep_interruptible` dead code.
This commit is contained in:
parent
ce47ee00ae
commit
7fd53eeb46
Notes:
git
2023-03-15 06:48:47 +00:00
Merged-By: ioquatix <samuel@codeotaku.com>
8 changed files with 6 additions and 328 deletions
40
signal.c
40
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue